2010-05-25, 07:43
I'm finding when working with button controls that the onclick event is being triggered even if the button isn't actually 'clicked'.
Example Code:
This renders a list of items/buttons that you can scroll through, however while scrolling the onclick event is being triggered. It almost seems as if 'onclick' is being handled as 'onfocus'.
NOTE: I just realized the items were being rendered as 'label'. I realize this is probably why, not my code, and now that I notice that I will fix it and check if the behavior is the same. Is the whole 'onclick' vs 'onfocus' point not still valid though?
Here's a a bit a code from a different portion, yet still using 'label' controls where 'onclick' functions as desired.
The only difference I can see is that one is a 'fixedlist' and one is a 'list', but why would this change the way the 'label' functions? Am I missing something obvious or is there a bug in the function of a 'label' where it's properties are altered based on it's parent type?
Here is a ZIP archive with three files demonstrating the functionality mentioned above.
CustomSettings.xml exhibits what I consider improper behavior.
Includes_HomeVertical.xml exhibits proper behavior.
Includes.xml has a few chunks of code required the complete the two files above.
I'm noticing this with XBMC for Windows DX (r30515).
Example Code:
Code:
<!-- Option Labels -->
<control type="list" id="9000">
<onup>9000</onup>
<ondown>9000</ondown>
<orientation>vertical</orientation>
<itemlayout height="38" width="380">
<control type="label">
<label>$INFO[ListItem.Label]</label>
</control>
</itemlayout>
<focusedlayout height="38" width="380">
<control type="label">
<label>$INFO[ListItem.Label]</label>
</control>
</focusedlayout>
<content>
<item id="1">
<description>Home</description>
<label>$LOCALIZE[10000]</label>
<onclick>SetFocus(9001)</onclick>
</item>
<item id="2">
<description>Views</description>
<label>$LOCALIZE[40001]</label>
<onclick>SetFocus(9002)</onclick>
</item>
</content>
</control>
This renders a list of items/buttons that you can scroll through, however while scrolling the onclick event is being triggered. It almost seems as if 'onclick' is being handled as 'onfocus'.
NOTE: I just realized the items were being rendered as 'label'. I realize this is probably why, not my code, and now that I notice that I will fix it and check if the behavior is the same. Is the whole 'onclick' vs 'onfocus' point not still valid though?
Here's a a bit a code from a different portion, yet still using 'label' controls where 'onclick' functions as desired.
Code:
<control type="fixedlist" id="9000">
<onup>9000</onup>
<ondown>9000</ondown>
<viewtype>list</viewtype>
<orientation>vertical</orientation>
<itemlayout width="700" height="86">
<control type="label">
<label>$INFO[ListItem.label]</label>
</control>
</itemlayout>
<focusedlayout width="700" height="104">
<control type="label">
<label>$INFO[ListItem.label]</label>
</control>
</focusedlayout>
<content>
<item id="1">
<description>Videos</description>
<label>$LOCALIZE[3]</label>
<onclick>ActivateWindow(videofiles)</onclick>
</item>
<item id="2">
<description>Movies</description>
<label>$LOCALIZE[342]</label>
<onclick>ActivateWindow(videolibrary,movietitles,return)</onclick>
</item>
</content>
</control>
The only difference I can see is that one is a 'fixedlist' and one is a 'list', but why would this change the way the 'label' functions? Am I missing something obvious or is there a bug in the function of a 'label' where it's properties are altered based on it's parent type?
Here is a ZIP archive with three files demonstrating the functionality mentioned above.
CustomSettings.xml exhibits what I consider improper behavior.
Includes_HomeVertical.xml exhibits proper behavior.
Includes.xml has a few chunks of code required the complete the two files above.
I'm noticing this with XBMC for Windows DX (r30515).