I am trying to create a drop down box with dynamic data source but i have some problems to find a good example for the implementation.
At the moment i have a normal drop down box similar to the one in the librocket StyleGuide .rcss file and the following implementation in the .rml file:
<select name="algorithm" source="algorithms.list"> <option fields="algorithms">Algorithms:</option> <option value=Algorithms:>Algorithms:</option> <option value="option2">Option 2</option> </select>
I found some information regarding datasources in the topic libRocket: DataGrid and DataSource issue and tried to adapt this for a select box but unfortunately this didn’t worked.
Its possible to add the elements with a python script that is executed before loading, the python code in the rml file can access global variables of the python module where librocket is started.
def loadAlgorithms(): element = document.GetElementById("1337") optionElement = document.CreateElement("option") optionElement.SetAttribute("value", "nothing") optionElement.inner_rml = "foo" element.AppendChild(optionElement) print "foo", len(element.child_nodes)