Jump to content

Can I get all created GUI elements in my server?


Recommended Posts

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.

Link to comment

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.

Link to comment
-- 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 )  

Link to comment

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

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.

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