ElementFormControlInput setValue

Discussion about using Python with libRocket.

ElementFormControlInput setValue

Postby shimrod on Sat Feb 18, 2012 10:18 pm

Hello,

I am using the binding of librocket through panda, and I got an issue.

From my main code, I loadDocument from my context, and it is ok.

My purpose is to give parameters to my rml, to parse it and show information related to this parameter (id of object for example, and in script part, on loadFonction, I will instantiate the right object, to retrieve information from it).

Because I am new in librocket, I imagine to declare in my rml, a hidden input, and to access to it from my main code, to put the right value.

Code: Select all
doc = context.LoadDocument('data/options.rml')
a=doc.GetElementById('objid')
a.SetValue("test")


my rml:
Code: Select all
<body template="pywindow" onload="LoadOptions(document)">
      <form name="formtest" onsubmit="SaveOptions(event, document);">
      <input type="hidden" id="objid" name="objid" value="0"/>
      <p>Informations</p>
      <br/>
      <p>Name : <input id="name" type="text" name="name" value="" /></p>
      <br/>
      <p><input type="submit" name="button" value="close">close</input></p>
      </form>
   </body>


my error :

AttributeError: 'ElementFormControlInput' object has no attribute 'SetValue'


where is my mistake?

how to give parameters to my rml and use it in my rml to show right information?
shimrod
 
Posts: 2
Joined: Sat Feb 18, 2012 10:12 pm

Re: ElementFormControlInput setValue

Postby lloydw on Sat Mar 03, 2012 12:00 am

The input fields are exposed as properties not functions, so you just want to do
Code: Select all
doc = context.LoadDocument('data/options.rml')
a=doc.GetElementById('objid')
a.value = 'test'


All the python binding information can been seen here:
https://github.com/lloydw/libRocket/blo ... erface.cpp
lloydw
Rocket Engineer
Rocket Engineer
 
Posts: 380
Joined: Tue Jan 15, 2008 10:56 pm


Return to libRocket and Python


cron