where shoud i put the code for a new custom window?
#1
I created a new xml file custom16.xml,and added
Code:
<onclick>ActivateWindow(4567)</onclick>
in the mainmenu in home.xml.

when click the main menu in homepage,the new dialog will popup.it's no problem.

this is the new xml file:
Code:
<window id="4567" type="dialog">
  <defaultcontrol>2</defaultcontrol>
  <allowoverlay>yes</allowoverlay>
  <visible>true</visible>
  <coordinates>
    <system>1</system>
    <posX>200</posX>
    <posY>100</posY>
  </coordinates>
  <controls>
    <control type="button" id="2">
      <description>test button</description>
      <posx>100</posx>
      <posy>100</posy>
      <width>100</width>
      <height>100</height>
      <onclick></onclick>
    </control>
  </controls>
</window>

i want do something when click the button in new window,but i don't know where should i put the code.
Reply
#2
culater Wrote:i want do something when click the button in new window,but i don't know where should i put the code.

not sure what you want the button to do,
but you just put the action in the <onclick></onclick> field of that button...
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#3
ronie Wrote:not sure what you want the button to do,
but you just put the action in the <onclick></onclick> field of that button...

thanks,ronie.

I want do something when the button click,like change a label text in the new window,get the weather info from a website,get a picture file from FTP....and so on.

I can write python code to achieve functional,but where put the code in?
Reply
#4
culater Wrote:thanks,ronie.

I want do something when the button click,like change a label text in the new window,

add two labels in your custom window with different visible conditions:
Code:
<control type="label">
  ..
  <visible>!Skin.HasSetting(Foo)</visible>
</control>
Code:
<control type="label">
  ..
  <visible>Skin.HasSetting(Foo)</visible>
</control>

and use:
Code:
<onclick>Skin.ToggleSetting(Foo)</onclick>

to change the visibility of the label.

culater Wrote:get the weather info from a website,get a picture file from FTP....and so on.

I can write python code to achieve functional,but where put the code in?

for the python code, you would need to create an addon.

you can run this addon by using:
<onclick>RunScript(script.foo)</onclick>


hope this helps :-)
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#5
ronie Wrote:for the python code, you would need to create an addon.

you can run this addon by using:
<onclick>RunScript(script.foo)</onclick>


hope this helps :-)

Yes,this is what I want! Thanks very much ronie.Big Grin
Reply

Logout Mark Read Team Forum Stats Members Help
where shoud i put the code for a new custom window?0