Kodi Community Forum
Reset widget properties if type set to none - 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: Reset widget properties if type set to none (/showthread.php?tid=354863)



Reset widget properties if type set to none - bsoriano - 2020-05-31

Hello all,

I use script.skinshortcuts to configure the menu/submenus/widgets in Amber.  I am not sure on how to code the script-skinshortcuts.xml to reset any widget properties I had previously set for a widget if I set the widget type (or path) to None.  For example, for my second widget, let's say, I have this code to set its properties (these are excerpts):


<control type="button" id="801">
                    <visible>String.IsEqual(Window.Property(groupname),mainmenu) + !Skin.HasSetting(Hide.AllShelves) + !String.IsEmpty(Container(211).ListItem.Property(widgetPath))</visible>
                    <description>Widget 2</description>
                    <label>$LOCALIZE[31491] 2</label>
                    <label2>$INFO[Container(211).ListItem.Property(widgetName.2)]</label2>
                    <onfocus condition="!String.IsEmpty(Window(Home).Property(skinshortcuts-Widget))">ClearProperty(skinshortcuts-Widget,Home)</onfocus>
                    <onclick>SetProperty(skinshortcuts-Widget,2,Home)</onclick>
                    <onclick>Control.SetFocus(4312)</onclick>
                    <height>60</height>
                    <width>1340</width>
                    <texturenofocus border="3">buttons/ButtonNF.png</texturenofocus>
                    <font>ListDetails</font>
                    <visible>!String.IsEqual(Container(211).ListItem.Property(skinshortcuts-disabled),True)</visible>
                </control>



<!-- Widget 2 settings -->
            <control type="group">
                <visible>String.IsEqual(Window(Home).Property(skinshortcuts-Widget),2)</visible>
                <control type="button" id="4100">
                    <left>425</left>
                    <width>1395</width>
                    <height>100%</height>
                    <onclick>back</onclick>
                    <texturefocus />
                    <texturenofocus />
                </control>
                <control type="grouplist" id="4000">
                    <top>240</top>
                    <left>500</left>
                    <width>1340</width>
                    <height>670</height>
                    <onleft>211</onleft>
                    <onright>60</onright>
                    <onup>4000</onup>
                    <ondown>4000</ondown>
                    <pagecontrol>60</pagecontrol>
                    <control type="button" id="4312">
                        <label>$LOCALIZE[31491] 2</label>
                        <label2>$INFO[Container(211).ListItem.Property(widgetName.2)]</label2>
                        <onclick>SetProperty(widgetID,2)</onclick>
                        <onclick>SendClick(312)</onclick>
                        <height>60</height>
                        <width>1340</width>
                        <texturenofocus border="3">buttons/ButtonNF.png</texturenofocus>
                        <font>ListDetails</font>
                    </control>
                    <control type="radiobutton" id="4002">
                        <visible>!String.IsEmpty(Container(211).ListItem.Property(widgetPath.2)) + String.IsEqual(Container(211).ListItem.Property(widgetTwoShelves),false) + 
                                 String.IsEqual(Container(211).ListItem.Property(widgetThreeShelves),false) + String.IsEqual(Container(211).ListItem.Property(widgetTriple.2),false)</visible>
                        <label>$LOCALIZE[31046]</label>
                        <onclick condition="!String.IsEmpty(Container(211).ListItem.Property(widgetDouble.2))">SetProperty(customProperty,widgetDouble.2)</onclick>
                        <onclick condition="String.IsEqual(Container(211).ListItem.Property(widgetDouble.2),true)">SetProperty(customProperty,widgetDouble.2)</onclick>
                        <onclick condition="String.IsEqual(Container(211).ListItem.Property(widgetDouble.2),false)">SetProperty(customValue,true)</onclick>
                        <onclick>SendClick(404)</onclick>
                        <selected>!String.IsEqual(Container(211).ListItem.Property(widgetDouble.2),false)</selected>
                        <height>60</height>
                        <width>1340</width>
                        <texturenofocus border="3">buttons/ButtonNF.png</texturenofocus>
                        <font>ListDetails</font>
                    </control>
                    <control type="radiobutton" id="4006">
                        <visible>!String.IsEmpty(Container(211).ListItem.Property(widgetPath.2)) + String.IsEqual(Container(211).ListItem.Property(widgetTwoShelves),false) + 
                             String.IsEqual(Container(211).ListItem.Property(widgetThreeShelves),false) + String.IsEqual(Container(211).ListItem.Property(widgetDouble.2),false)</visible>
                        <label>$LOCALIZE[31045]</label>
                        <onclick condition="!String.IsEmpty(Container(211).ListItem.Property(widgetTriple.2))">SetProperty(customProperty,widgetTriple.2)</onclick>
                        <onclick condition="String.IsEqual(Container(211).ListItem.Property(widgetTriple.2),true)">SetProperty(customProperty,widgetTriple.2)</onclick>
                        <onclick condition="String.IsEqual(Container(211).ListItem.Property(widgetTriple.2),false)">SetProperty(customValue,true)</onclick>
                        <onclick>SendClick(404)</onclick>
                        <selected>!String.IsEqual(Container(211).ListItem.Property(widgetTriple.2),false)</selected>
                        <height>60</height>
                        <width>1340</width>
                        <texturenofocus border="3">buttons/ButtonNF.png</texturenofocus>
                        <font>ListDetails</font>
                    </control>
                    <control type="button" id="4003">
                        <visible>!String.IsEmpty(Container(211).ListItem.Property(widgetPath.2)) + !String.IsEqual(Container(211).ListItem.Property(widget.2),static) + 
                                 !String.IsEqual(Container(211).ListItem.Property(widgetType.2),custom)</visible>
                        <label>$LOCALIZE[31480]</label>
                        <label2>$INFO[Container(211).ListItem.Property(widgetSortBy.2)]</label2>
                        <height>60</height>
                        <width>1340</width>
                        <texturenofocus border="3">buttons/ButtonNF.png</texturenofocus>
                        <font>ListDetails</font>
                    </control>
                    <control type="button" id="4004">
                        <visible>!String.IsEmpty(Container(211).ListItem.Property(widgetPath.2)) + !String.IsEqual(Container(211).ListItem.Property(widgetSortBy.2),random) + 
                                 !String.IsEmpty(Container(211).ListItem.Property(widgetSortBy.2)) + !String.IsEqual(Container(211).ListItem.Property(widget.2),static) + 
                                 !String.IsEqual(Container(211).ListItem.Property(widgetType.2),custom)</visible>
                            <label>$LOCALIZE[31481]</label>
                            <label2>$INFO[Container(211).ListItem.Property(widgetSortOrder.2)]</label2>
                            <height>60</height>
                            <width>1340</width>
                            <texturenofocus border="3">buttons/ButtonNF.png</texturenofocus>
                            <font>ListDetails</font>
                        </control>
                        <control type="button" id="4005">
                            <visible>!String.IsEmpty(Container(211).ListItem.Property(widgetPath.2)) + !String.IsEqual(Container(211).ListItem.Property(widget.2),static) + 
                                     !String.IsEqual(Container(211).ListItem.Property(widgetType.2),custom)</visible>
                            <label>$LOCALIZE[31482]</label>
                            <label2>$INFO[Container(211).ListItem.Property(widgetLimit.2)]</label2>
                            <height>60</height>
                            <width>1340</width>
                            <texturenofocus border="3">buttons/ButtonNF.png</texturenofocus>
                            <font>ListDetails</font>
                        </control>
                    </control>
                </control>

So if I configure this widget and build the menu, and then I go back to the management dialog and set the path to none, which means widgetType.2 is set to none, I want to reset the other properties, widgetDouble.2, widgetTriple.2, widgetSortBy.2, widgetSortOrder.2 and widgetLimit.2.  How could I go about doing this? the skinshortcuts script does not reset any properties on its own, so widgets are keeping whatever properties I had set for them.

@BobCratchett , @Mr. V , @jurialmunkey , @mikeSiLVO  any ideas? 

Thank you in advance for any help, and I apologize in advance if this is something simple that I am just overlooking.

Regards,

Bart


RE: Reset widget properties if type set to none - bsoriano - 2020-06-01

I figured it out.  I added the below to the button for the widget. So now, if the path is set to none, the widgetDouble and widgetTriple properties will be set to false.


<onunfocus condition="String.IsEmpty(Container(211).ListItem.Property(widgetPath.2))">SetProperty(customProperty,widgetDouble.2)</onunfocus>
                        <onunfocus condition="String.IsEmpty(Container(211).ListItem.Property(widgetPath.2))">SetProperty(SetProperty(customValue,false))</onunfocus>
                        <onunfocus condition="String.IsEmpty(Container(211).ListItem.Property(widgetPath.2))">SendClick(404)</onunfocus>
                        <onunfocus condition="String.IsEmpty(Container(211).ListItem.Property(widgetPath.2))">SetProperty(customProperty,widgetTriple.2)</onunfocus>
                        <onunfocus condition="String.IsEmpty(Container(211).ListItem.Property(widgetPath.2))">SetProperty(SetProperty(customValue,false))</onunfocus>
                        <onunfocus condition="String.IsEmpty(Container(211).ListItem.Property(widgetPath.2))">SendClick(404)</onunfocus>

Regards,

Bart


This forum uses Lukasz Tkacz MyBB addons.