Kodi Community Forum

Full Version: proble with radiobutton
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hi all

i am writing a liitle script and i am having problem with setSelected()

i am building a list of radiobutton with windowsxml

thats is how i build the radiobutton:

Code:
for($i=0,$k=101;$i<sizeof($elem);$i++)
               {
                   $content=($content.'<control type="grouplist" id="900">
                    <visible>Container(9000).Hasfocus('.$i.')</visible>
                                <posx>290</posx>
                                    <posy>60</posy>
                                  <width>750</width>
                                  <height>530</height>
                                  <itemgap>-1</itemgap>
                                  <pagecontrol>-</pagecontrol>
                                  <onleft>9000</onleft>
                                  <onright>9000</onright>
                                  <onup>9001</onup>
                                  <ondown>9001</ondown>');
                                 for($j=0;$j<sizeof($elem[$i]);$j++)
                                 {
                                 $content=($content.'<control type="radiobutton" id='.$k.'>
                                        <width>750</width>
                                        <height>40</height>
                                        <font>font13</font>
                                        <label>'.$elem[$i][$j]['name'].'</label>
                                        <textcolor>grey2</textcolor>
                                        <focusedcolor>white</focusedcolor>
                                        <texturefocus>MenuItemFO.png</texturefocus>
                                        <texturenofocus>MenuItemNF.png</texturenofocus>
                                        <selected>'.$elem[$i][$j]['status'].'</selected>
                                      </control>');
                                      $k++;
                                 }
                      $content=($content.'</control>');
               }

as you can see i build the xml dynamic with php

here the part on the script when i want to change the state of the radiobutton

Code:
class openRoomWindow(xbmcgui.WindowXML):
  
  def onClick(self, id):
    self.getControl( id ).setSelected(False)


def openroom(id):
  req=urllib2.Request('http://localhost/xbmc/GetElements.php?roomid='+id)
  response=urllib2.urlopen(req)
  ui = openRoomWindow('filename.xml', os.getcwd())
  ui.doModal()
but when i click on the radiobutton he dosent chagne state!!!!


anyone know what is the problem??

Thank you
ofer
i think i found what cause the problem but i dont know how to solve it

when i remove from the xml file the tag <selected></selected>
i can change the button state

but i dont want to remove this tag becuse i need the button load with my defualt state

any idle?

thank you
ofer
Perhaps because the internal control changes state, so you're just changing it back?
No it is not the case i try to change the same button to False and True no matter what i try to button doesnt change

any more idle


Thank you
Ah - I hadn't read that you have <selected> defined. In that case it will always be on (or off - depending on what you specify).

If you wish to specify a state initially, I suggest using onInit to setup the state.
Thank you very much
this is what i am trying to do now