fadetoblack Posted April 18, 2012 Share 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? Link to comment
Castillo Posted April 19, 2012 Share Posted April 19, 2012 You mean clicking on "air" it'll close the GUI? Link to comment
fadetoblack Posted April 19, 2012 Author Share Posted April 19, 2012 I meant - clicking outside GUI window, will close it. Link to comment
50p Posted April 19, 2012 Share 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. Link to comment
Michael# Posted April 19, 2012 Share 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" ? Link to comment
50p Posted April 19, 2012 Share Posted April 19, 2012 Yeah, it could be but still, should work with root too. Link to comment
naz19 Posted April 19, 2012 Share Posted April 19, 2012 as i understand you, u must use event onClientGUIClick, and check if your window isn't source. Link to comment
50p Posted April 19, 2012 Share 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. Link to comment
naz19 Posted April 20, 2012 Share Posted April 20, 2012 btw i seen same thing (like click outside of window to close it) in color picker (freeroam resource) Link to comment
Michael# Posted April 20, 2012 Share Posted April 20, 2012 @@naz19, no double post haha Link to comment
Puma Posted April 21, 2012 Share 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. Link to comment
fadetoblack Posted June 6, 2012 Author Share 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? Link to comment
Al3grab Posted June 6, 2012 Share Posted June 6, 2012 something like that .. addEventHandler("onClientGUIClick",root,function() if ( guiGetVisible(myGui) == true and source ~= myGui ) then guiSetVisible(myGui,false) end end ) 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