Kodi Community Forum
How to display the label when user clicks on the button? - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Skinning (https://forum.kodi.tv/forumdisplay.php?fid=12)
+--- Thread: How to display the label when user clicks on the button? (/showthread.php?tid=127749)



How to display the label when user clicks on the button? - slinuxgeek - 2012-04-04

Hi,
I have a label whose id is 5 and also a button .
The lable is hidden.
I want to display the label when user clicks on the button.

what should I write in <onclick> Huh </onclick> of the button.
I could not find any function like control(id).show( )

Thanks


RE: How to display the label when user clicks on the button? - pecinko - 2012-04-04

E.g.

Skin.SetString

or

SetProperty(key,value[,id])

and set label visibility based on that.


RE: How to display the label when user clicks on the button? - slinuxgeek - 2012-04-04

Any other way please !!

Thanks for reply.


How to display the label when user clicks on the button? - pecinko - 2012-04-04

Why?


RE: How to display the label when user clicks on the button? - henrava - 2012-04-04

You can try with:
<control type="button" id="8005">
<label>yourlabel</label>
<visible>Control.HasFocus(8005)</visible>

When you have focus on button, it became visible.


RE: How to display the label when user clicks on the button? - Hitcher - 2012-04-04

Or Control.GetLabel(BUTTON_ID) if that's what you mean.


RE: How to display the label when user clicks on the button? - slinuxgeek - 2012-04-05

I actually simplified the question , actually I am trying to make a drop down menu , whose selected value will be represented by the label of the button which is on top of the menu.
menu may be achieved by a list control,which is by default hidden when user clicks on the button the drop down menu appears just below the button. user clicks on any choice of list and that choice's label becomes label of button.

I don't want the list control to become visible when button is focused but when the button is clicked.
Now there might appear a solution like:
<control type="button">
<onclick>setfocus(list_id)</onclick>
--------many lines--------
</control>
and list control will be like:
<control type="list" id="list_id">
<visible allowhiddenfocus="true">Control.HasFocus(list_id)</visible>
--------many lines--------
</control>

but in this case even if you don't click on button and simply move your mouse to the area where the list is but is hidden, the list control becomes visible which is bad.

Any Solution ?
Thanks.





RE: How to display the label when user clicks on the button? - slinuxgeek - 2012-04-05

(2012-04-04, 19:27)pecinko Wrote: Why?

Because , when move mpuse out of the label I want the label should again become invisible , we will have to reset the string value but how & when ? means where we will write Skin.SetString(.......)?



RE: How to display the label when user clicks on the button? - butchabay - 2012-04-05

Maybe you could try something like:


PHP Code:
<control type="radiobutton" id="1">
<
width>750</width>
<
height>35</height>
<
font>font_20</font>
<
label>label1</label>
<
textcolor>grey2</textcolor>
<
focusedcolor>white</focusedcolor>
<
texturefocus flipx="true">listwhitegradient.png</texturefocus>
<
texturenofocus>menuitemNF.png</texturenofocus>
<
onclick>Skin.ToggleSetting(enable_dropdown_list)</onclick>
<
selected>Skin.HasSetting(enable_dropdown_list)</selected>
</
control>
<
control type="radiobutton" id="2">
<
width>750</width>
<
height>35</height>
<
font>font_20</font>
<
label>List Label 1</label>
<
textcolor>grey2</textcolor>
<
focusedcolor>white</focusedcolor>
<
texturefocus flipx="true">listwhitegradient.png</texturefocus>
<
texturenofocus>menuitemNF.png</texturenofocus>
<
onclick>Skin.ToggleSetting(what_you_want)</onclick>
<
visible>Skin.HasSetting(enable_dropdown_list)</visible>
</
control



RE: How to display the label when user clicks on the button? - slinuxgeek - 2012-04-05

Here is what I have done:
<control type="button">
<ondown>Skin.ToggleSetting(enable_dropdown_list)</ondown>
<ondown>setfocus(6)</ondown>

<onclick>Skin.ToggleSetting(enable_dropdown_list)</onclick>
<onclick>setfocus(6)</onclick>
</control>

Here is List control with many choices:

<control type="list" id="6">
<visible allowhiddenfocus="false">Skin.HasSetting(enable_dropdown_list) </visible>
</control>

when I press down arrow key on button the list control becomes visible but the list control does not take focus, so I can not press up and down arrow keys to traverse the choices with in list control.

If I write allowhiddenfocus="true" the list becomes visible when I move mouse over that area without any intension to see the list , which is bad.

what wrong I have written?


Thanks for help?


RE: How to display the label when user clicks on the button? - butchabay - 2012-04-05

If you don't post the complete code it will be difficult to help you.


RE: How to display the label when user clicks on the button? - slinuxgeek - 2012-04-05

PHP Code:
<control type="group"><!-- pull down menu to select AlbumsArtistsSongsFiles-->
                  <
description>Select of AlbumsArtistsSongsFiles </description>
                  <
posx>220</posx>
                  <
posy>5</posy>
                  <
width>230</width>
                  <
height>50</height>
                      <
control type="button" id="4724">
                    <
posx>1</posx>
                    <
posy>1</posy>
                    <
width>160</width>
                    <
label>$INFO[Skin.String(choice2)]</label>
                    <
align>center</align>
                    <
texturefocus>fg1.png</texturefocus>    
                    <
texturenofocus>fg.png</texturenofocus>
                    <
onleft>4723</onleft>
                    <
onright>19</onright>

                    <
ondown>Skin.ToggleSetting(enable_dropdown_list2)</ondown>
                    <
ondown>6</ondown>
                    <
onclick>Skin.ToggleSetting(enable_dropdown_list2)</onclick>

                </
control>
                <
control type="list" id="6">
                      <
description>List of the choices AlbumsArtistsSongs and Files</description>
                      <
posx>1</posx>
                      <
posy>41</posy>
                      <
width>160</width>
                      <
height>130</height>

                      <!--
onleft>Skin.ToggleSetting(enable_dropdown_list2)</onleft-->
                    <
onleft>4724</onleft>
                      <
visible allowhiddenfocus="false">Skin.HasSetting(enable_dropdown_list2) </visible>

                    <
itemlayout width="160" height="30">
                    <
control type="image">
                          <
description>image control</description>
                          <
posx>0</posx>
                          <
posy>1</posy>
                          <
width>160</width>
                          <
height>30</height>
                          <
texture>fg.png</texture>
                    </
control>
                    <
control type="label">
                        <
posx>50</posx>
                         <
posy>1</posy>
                        <
width>160</width>
                        <
height>30</height>
                        <
font>font12</font>
                        <
info>ListItem.Label</info>
                        <
textcolor>0xffffffff</textcolor>
                        <
aligny>center</aligny>
                    </
control>
                            </
itemlayout>
                            <
focusedlayout width="160" height="30">
                    <
control type="image">
                          <
description>image control</description>
                          <
posx>0</posx>
                          <
posy>1</posy>
                          <
width>160</width>
                          <
height>30</height>
                          <
texture>fg1.png</texture>
                    </
control>
                    <
control type="label">
                        <
posx>50</posx>
                         <
posy>1</posy>
                        <
width>160</width>
                        <
height>30</height>
                        <
font>font13</font>
                        <
info>ListItem.Label</info>
                        <
textcolor>0xffffffff</textcolor>
                        <
shadowcolor>ff441400</shadowcolor>
                        <
aligny>center</aligny>
                    </
control>
                      </
focusedlayout>
         
                        <
content><!-- Static contents -->
                          <
item id="1">
                            <
label>Songs</label>
                            <
onclick>Skin.SetString(choice2,"Songs")</onclick>
                            <
onclick>ActivateWindow(MusicLibrary,Songs,return)</onclick>
                          </
item>
                          <
item id="2">
                            <
label>Artists</label>
                            <
onclick>Skin.SetString(choice2,"Artists")</onclick>
                            <
onclick>ActivateWindow(MusicLibrary,Artists,return)</onclick>
                          </
item>
                          <
item id="3">
                            <
label>Albums</label>
                            <
onclick>Skin.SetString(choice2,"Albums")</onclick>
                            <
onclick>ActivateWindow(MusicLibrary,Albums,return)</onclick>
                          </
item>
                          <
item id="4">
                            <
label>Files</label>
                            <
onclick>Skin.SetString(choice2,"Files")</onclick>
                            <
onclick>ActivateWindow(musicfiles)</onclick>
                          </
item>
                    </
content>
                    </
control>
        </
control



RE: How to display the label when user clicks on the button? - `Black - 2012-04-05

If mouse is the problem, try adding a dummy button over the list so the button becomes focus if you move with the mouse over the hidden list.


RE: How to display the label when user clicks on the button? - slinuxgeek - 2012-04-05

Thanks for Reply `Black but there is a panel control below the list control which displays songs list which should be clickable to play the song.

As you know in any text editor like notepad you type in text area but if you click on File menu a long list of menu is displayed which occupies some part of text area but only when it is displayed other wise user is able to click on the text area where menu was visible and can type any thing.

Thank you.