manuelhimmler Posted December 24, 2009 Share Posted December 24, 2009 Hi Community! I wanted to script an admin panel for my server but the problem is if I click on the window of a button or more button the event of the buttons of the window get triggered. I don't know why, is this a common problem or could this only be a script error? Link to comment
subenji99 Posted December 24, 2009 Share Posted December 24, 2009 Syntax bool addEventHandler ( string eventName, element attachedTo, function handlerFunction, [bool getPropagated = true] ) Optional ArgumentsgetPropagated: A boolean representing whether the handler will be triggered if the event was propagated down or up the element tree (starting from the source), and not triggered directly on attachedTo (that is, handlers attached with this argument set to false will only be triggered if source == this). https://wiki.multitheftauto.com/wiki/AddEventHandler In the Element Tree, a GUI window's buttons are children of the GUI window. When you click on the GUI window, the event propagates down the tree, and finds the buttons. If their event handlers have "getPropagated = true" then they receive the event and react as though you clicked on them. Just set that final argument false on your button event handlers. And learn how the event system works. Link to comment
manuelhimmler Posted December 24, 2009 Author Share Posted December 24, 2009 Thanks, i know the event system, but I never used getPropagated becasue this is only important by GUIs and I don't script GUIs often. 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