Vantha Posted February 12 Report Share Posted February 12 I have a dropdown in an XML for a GUI page like this: <object name="dropdown" type="dropdown"/> I know I can add items like this: <item>name of the first item</item> <item>name of the second item</item> The problem is that I want to have more than ten items in the dropdown, and preferably add them from a JavaScript script instead of listing all of them in the XML. How can I do that? I found list functions here: https://trac.wildfiregames.com/wiki/Exposed_GUI_Functions#List_functions. But I'm not sure how to use them. And from a quick search not a single instance of 'addItem' or 'pushItem' was found in 0ad's code. 1 Quote Link to comment Share on other sites More sharing options...
Stan` Posted February 12 Report Share Posted February 12 You can't add dynamic GUI objects. You have to know how many you'll display, or at least have more on the page. I think colors have more than ten items. Quote Link to comment Share on other sites More sharing options...
vladislavbelov Posted February 12 Report Share Posted February 12 3 hours ago, Vantha said: The problem is that I want to have more than ten items in the dropdown, and preferably add them from a JavaScript script instead of listing all of them in the XML. How can I do that? If you just want dropdown values then you might take a look at binaries/data/mods/public/gui/options/. We add dropdown values dynamically via JS for options. 30 minutes ago, Stan` said: You can't add dynamic GUI objects. If I'm not mistaken the question is about many values not many dropdowns. 3 Quote Link to comment Share on other sites More sharing options...
Vantha Posted February 12 Author Report Share Posted February 12 1 hour ago, vladislavbelov said: If you just want dropdown values then you might take a look at binaries/data/mods/public/gui/options/. We add dropdown values dynamically via JS for options. Thanks. I found there what I've been searching for. Quote Link to comment Share on other sites More sharing options...
Vantha Posted February 12 Author Report Share Posted February 12 1 hour ago, vladislavbelov said: If I'm not mistaken the question is about many values not many dropdowns Yes, that's what I was asking. I probably should have been more precise. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.