Jump to content

Click outside GUI to close?


Recommended Posts

Posted

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?

Posted

You mean clicking on "air" it'll close the GUI?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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.

Posted
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" ?

Posted

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.

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

Posted

something like that ..

  
addEventHandler("onClientGUIClick",root,function() 
       if ( guiGetVisible(myGui) == true and source ~= myGui ) then 
            guiSetVisible(myGui,false) 
       end 
end ) 
  

ING : [xXx]~Al3grab

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