Stanley Sathler Posted December 8, 2015 Posted December 8, 2015 Hey guys, Is there a way to get all GUI elements? I mean, I would like to get a table containing all GUI elements created in my server, doesn't matter if is visible or not. If I want to retrieve all vehicles in my server, I use getElementsByType("vehicle"). Same for players, markers, etc. Is there something similar for CEGUI elements? Regards, Stanley Sathler.
RenanPG Posted December 8, 2015 Posted December 8, 2015 As far as i know you can loop through the predefined variable guiRoot, but you'll need a recursion to get all elements, because exists children of children GUIs. guiRoot > Window > Button (an example of a gui tree)
Stanley Sathler Posted December 8, 2015 Author Posted December 8, 2015 Hornet, and where can I learn more about guiRoot itself? I mean, I have read about element tree, but didn't find anything about guiRoot there. It's because I don't know how I can access the elements under guiRoot. Is it a table? An object? How can I, for example, access the window elements? Could you show me an example code? Thanks in advance, Stanley Sathler.
Saml1er Posted December 8, 2015 Posted December 8, 2015 -- I am not sure gui-element is a type used for all elements because I could not find it on wiki but check if it works local table1 = getElementsByType("gui-element") or local table1 = getElementChildren ( guiRoot ) If you want to get all the window elements then local table1 = getElementsByType("gui-window") You can also get window elements created by the resource running this script local table1 = getElementsByType("gui-window", resourceRoot )
MTA Team botder Posted December 8, 2015 MTA Team Posted December 8, 2015 https://wiki.multitheftauto.com/wiki/Ge ... GUIElement You can use the getElementID hack to get every resource https://forum.multitheftauto.com/viewtopic.php?f=91&t=94573
Saml1er Posted December 8, 2015 Posted December 8, 2015 https://wiki.multitheftauto.com/wiki/GetResourceGUIElementYou can use the getElementID hack to get every resource https://forum.multitheftauto.com/viewtopic.php?f=91&t=94573 Woaah, I never saw this functiom before.
Stanley Sathler Posted December 10, 2015 Author Posted December 10, 2015 Saml1er and Necktrox, I did it using getResourceGUIElement(). I was in doubt about how guiRoot would work, but now I know that it's the same that the function above. So, as I asked before: yes, it's a table. In this way, I can say that I used Necktrox's suggestion or Saml1er's second suggestion (which is the same). And I would to thank all you guys, because you helped me a lot. Regards, Stanley Sathler.
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