Jump to content

Click outside GUI to close?


Recommended Posts

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
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
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

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
  • 1 month later...
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

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...