simstosh Posted August 8, 2010 Share Posted August 8, 2010 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: <<<< Login Screen <<<< Setup Info Screen <<< Choose Team Screen (With the mouse around the image and over a portion of the button, marked with a red circle) <<<< 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
dzek (varez) Posted August 8, 2010 Share Posted August 8, 2010 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
simstosh Posted August 9, 2010 Author Share Posted August 9, 2010 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 ). 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
Remp Posted August 9, 2010 Share Posted August 9, 2010 use guiSetProperty to set "MousePassThroughEnabled" to "true" on the images this will make your mouse clicks simply pass through the image and onto the button instead Link to comment
dzek (varez) Posted August 9, 2010 Share Posted August 9, 2010 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
simstosh Posted August 9, 2010 Author Share Posted August 9, 2010 @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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now