Jump to content

[HELP]GUI, Image and Buttons problem...


simstosh

Recommended Posts

Hi...

I'm starting with lua about 5/7 days, but I've learned how to use the language and some functions (I script PHP/Pawn, and some others, so I have an idea how lua works)...

But I want to do something that I can't solve...

I've created some GUI's (Login GUI / After Login GUI (Setup Player Info) / Team Choose) integrated each other, and some checks to show the right menu depending on value presented by DB.

My problem's related to the Team Choose GUI. I do some buttons for the teams, with a Image in, but if you click on the image, the button doesn't work, u need to click around him to works. I want to do if a player clicks on the button and/or image, the function works.

Pastebin Link (chooseteam_client.lua)

http://pastebin.com/t1PcTGYd

Here some images of the GUI's:

mtagui1.th.jpg <<<< Login Screen

mtagui2.th.jpg <<<< Setup Info Screen

mtagui3marked.th.jpg <<< Choose Team Screen (With the mouse around the image and over a portion of the button, marked with a red circle)

mtagui3nomarked.th.jpg <<<< Choose Team Screen (With the mouse over the image, marked with a red circle)

So, what I need to do, in this case? I've tried to associate the image to the window and put in the back of the button, but he doesn't show... (Normally, the image is associated with the button)

(Obs: I have problem only with the image/button GUI, not with the codes, well, all are working perfectly, I only want to "split" the image and the button in the same "button")

Thanks ;)

Link to comment

I think you forgot to show us some code ;)

But what can i say without? I think you could add same action for button and image - so button and image will trigger what you want. But probably this could be solved by setting right parent element for images. I'm not sure as I never created image on top of button, but we could try this.. Anoter extra option is to include this button border into image - so there will be no buttons, just clickable images :)

Link to comment

No, i haven't forgot anything, this is the "complete" client-side lua file (Pastebin link).

So, i've tried to add a EventHandler to the image (onClientGUIClick) referring to the images, but doesn't work (I think is because it's only for buttons :P). Exist some parameter to "transform" the images "invisible" to the mouse, or something like that? I've tried the AlwaysOnTop to the button, guiMoveToBack() to the image but nothing works...

Link to comment

wow, i didnt see pastebin link ;|

two lines of my script:

wnd_color.img = guiCreateStaticImage (0,20,330,330,'vehiclecolors.png',false,wnd_color.wnd)
addEventHandler ("onClientGUIClick", wnd_color.img, colorSelection, false)

so its possible to bind "click" to image cause this script is working fine :)

Link to comment

@Remp

Ty, that's what I was talking. Now works. I've searched on the parameters but haven't noticed about this parameter :)

Well, this is very useful for much people, and for me... Thanks so much.

@varez

I've tried the OnClientGUIClick event, but doesn't work... But the Remp tip worked the way that I thought.

Anyway, thanks too... :)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...