fadetoblack Posted April 18, 2012 Posted April 18, 2012 Hi! On some servers I noticed that they have a quick trick to close the GUI Windows - clicking outside. How to do that, but without breaking my element-clicking system?
Castillo Posted April 19, 2012 Posted April 19, 2012 You mean clicking on "air" it'll close the GUI? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
fadetoblack Posted April 19, 2012 Author Posted April 19, 2012 I meant - clicking outside GUI window, will close it.
50p Posted April 19, 2012 Posted April 19, 2012 If MTA element tree works the way the developers say it does then this should hide all gui elements when you click outside GUI elements: addEventHandler( "onClientClick", root, function( btn ) if btn == "left" then guiSetVisible( root, false ); -- this should hide all the GUI visible end end ) If you get an error message then you have to specify which GUI element (window) you want to hide. - MTA Script Editor - Ask your scripting questions properly, please. - 50p's public resources - Meta.xml - what is it for? How is it possible LOL
Michael# Posted April 19, 2012 Posted April 19, 2012 If MTA element tree works the way the developers say it does then this should hide all gui elements when you click outside GUI elements: addEventHandler( "onClientClick", root, function( btn ) if btn == "left" then guiSetVisible( root, false ); -- this should hide all the GUI visible end end ) If you get an error message then you have to specify which GUI element (window) you want to hide. guiSetVisible( root, false ); Isn't "guiRoot" ?
50p Posted April 19, 2012 Posted April 19, 2012 Yeah, it could be but still, should work with root too. - MTA Script Editor - Ask your scripting questions properly, please. - 50p's public resources - Meta.xml - what is it for? How is it possible LOL
naz19 Posted April 19, 2012 Posted April 19, 2012 as i understand you, u must use event onClientGUIClick, and check if your window isn't source. Mr. Naz
50p Posted April 19, 2012 Posted April 19, 2012 as i understand you, u must use event onClientGUIClick, and check if your window isn't source. If the window isn't source, it can be something else. The user can't click any GUI therefore can't raise onClientGUIClick event. - MTA Script Editor - Ask your scripting questions properly, please. - 50p's public resources - Meta.xml - what is it for? How is it possible LOL
naz19 Posted April 20, 2012 Posted April 20, 2012 btw i seen same thing (like click outside of window to close it) in color picker (freeroam resource) Mr. Naz
Puma Posted April 21, 2012 Posted April 21, 2012 Haven't tested nor used it, but I think you mean onClientGUIBlur. https://wiki.multitheftauto.com/wiki/OnClientGUIBlur This event is triggered each time a GUI element looses input focus (mainly useful for windows, editboxes and memos but triggered for all GUI elements nevertheless). When you click outside a window, it looses focus. When this event is triggered, you simply hide/destroy/disable/dowhateveryouwanttodowith the gui-stuff. "The total IQ of the world is a constant. The more people, the more idiots." - Anonymous.
fadetoblack Posted June 6, 2012 Author Posted June 6, 2012 Haven't tested nor used it, but I think you mean onClientGUIBlur.https://wiki.multitheftauto.com/wiki/OnClientGUIBlur This event is triggered each time a GUI element looses input focus (mainly useful for windows, editboxes and memos but triggered for all GUI elements nevertheless). When you click outside a window, it looses focus. When this event is triggered, you simply hide/destroy/disable/dowhateveryouwanttodowith the gui-stuff. It works only when client choose other window, not when he click somewhere outside. Any other ideas?
Al3grab Posted June 6, 2012 Posted June 6, 2012 something like that .. addEventHandler("onClientGUIClick",root,function() if ( guiGetVisible(myGui) == true and source ~= myGui ) then guiSetVisible(myGui,false) end end ) ING : [xXx]~Al3grab
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