Solved How to reset a state of a dialog window?
#1
I would like to reset a dialog-type window with an ID, and I would like it to behave as if it were always the first time every time it is opened, so that I don't remember the last state.

Is it possible to have it reset every time when opening?

I know that kodi always remembers the last state of the windows, how do you prevent this in a particular window?


Instance:

<onunload>ClearProperty (Window ID) </onunload>  (something like this ... )


It's not a question of resetting a position (which can be done with setfocus) but of a list with automatic set on the scrollbar, and every time the window is opened (where before it was gone up to the last element of the list NOT selectable) it goes in automatic scroll up bringing me back to the first element, the problem is that I would not like to see this automatic scroll that takes me back to the first element of the list, but it must already be at the first element of the list.


Thank you very much for any help
If i helped you, you can thank me with a thumbs up 👍 below, thanks 🙏.
Kodi 20.x stable release | Skin Confluence (by Jezz_X)
I like editing skins ❤
Reply
#2
I've used this trick to good effect, courtesy of @manfeed - https://forum.kodi.tv/showthread.php?tid...pid3084227

If the textbox you are working with is a built-in control, you may need to make it hidden and then add your own textbox so have control over the <label>tag in order to add the extra window property.

In that case, you could then pass the label from the built-in textbox to your textbox in the <label> tag like so.

xml:

<control type="textbox" id="123">
   <visible>false</visible>
</control>

xml:

<control type="textbox">
   <label>$INFO[Control.GetLabel(123)]$INFO[Window(home).Property(ResetScroll)]</label>
   ...
</control>
Reply
#3
@realcopacetic

Thank you very much for your reply, perhaps I have not been able to explain myself well, and for this I ask you to forgive me.

I don't have any textbox with autoscroll, but I have many label inside various panels, all inserted in a large panel.
this large panel is connected with a scrollbar, directly to the opening, so as to press the down arrow to scroll it and show all the labels (all information).

The problem is that when I open the panel and I scroll all the way, when the next time I reopen it in another element, this panel starts from the bottom (from the last element in which I had left it) and automatically starts scrolling up, showing me all the swipe up animation.

I tried trying to use that code you provided but i was unable to get it to work.


Can I ask you how to implement the code you provided me in this window of mine, or adapt it based on what I said above?

To try to understand better, here is my simplified code of what I mean:

xml:
<window type="dialog" id="1000">
   <defaultcontrol always="true">10030</defaultcontrol>
    <controls>
    
        <control type="group">
          <control type="grouplist">
                <orientation>vertical</orientation>
                <pagecontrol>10030</pagecontrol>
                <scrolltime>3000</scrolltime>
                    <control type="label">
                        <width>525</width>
                        <height>120</height>
                        <label>Budget: $INFO[ListItem.Property(Budget)]</label>
                        <visible>!String.IsEmpty(ListItem.Property(Budget))</visible>
                    </control>
                    < ... > (another label)
            <control type="grouplist">
                <left>715</left>
                <width>600</width>
                <orientation>horizontal</orientation>
                <pagecontrol>10030</pagecontrol>
                <scrolltime>3000</scrolltime>
                    <control type="image">
                        <width>50</width>
                        <height>50</height>
                        <texture>$INFO[Window(Home).Property(TMDbHelper.ListItem.Provider.1.Icon)]</texture>
                        <visible>!String.IsEmpty(Window(Home).Property(TMDbHelper.ListItem.Provider.1.Icon))</visible>
                    </control>
                    <control type="label">
                        <height>50</height>
                        <label>$INFO[Window(Home).Property(TMDbHelper.ListItem.Provider.1.Name)]</label>
                        <visible>!String.IsEmpty(Window(Home).Property(TMDbHelper.ListItem.Provider.1.Name))</visible>
                    </control>
            </control>
            
            <control type="scrollbar" id="10030">
                <left>1260</left>
                <top>90</top>
                <width>20</width>
                <texturesliderbackground border="0,14,0,14">ScrollBarV.png</texturesliderbackground>
                <texturesliderbar border="2,16,2,16">ScrollBarV_bar.png</texturesliderbar>
                <texturesliderbarfocus border="2,16,2,16">ScrollBarV_bar_focus.png</texturesliderbarfocus>
                <textureslidernib/>
                <textureslidernibfocus/>
                <showonepage>false</showonepage>
                <orientation>vertical</orientation>
                <visible allowhiddenfocus="true">true</visible>
            </control>

            
          </control>
        </control>
        
    </controls>
</window>



Thank you very much 🙏
(+1 if you can help me ❤)
If i helped you, you can thank me with a thumbs up 👍 below, thanks 🙏.
Kodi 20.x stable release | Skin Confluence (by Jezz_X)
I like editing skins ❤
Reply
#4
If you don’t mind dirty hacks I would try something like this:

Xml:

<onload>SetFocus(10030)</onload>
<onload>Action(Up)</onload>
<onload>Action(Up)</onload>
…as many lines like that as you need…
<onload>Action(Up)</onload>
<onload>SetFocus(…I would give a number to your grouplist so that it could be put here…)</onload>

…not sure if it’ll work, it’s a matter of testing it.
If I have helped you or increased your knowledge, please click the 'thumbs up' button to give thanks :)
Reply
#5
@manfeed

Unfortunately it doesn't work, as it doesn't seem to take "Action(Up)" into consideration so it behaves the same way as before.

I think we need a more complex command, even if I expected it to be simpler.

odd that there are no reset properties of a window (to forget its last state).


I hope, and please 🙏 help me find a command that can work, I don't know what else to do...



Thank you very much for your precious help.
If i helped you, you can thank me with a thumbs up 👍 below, thanks 🙏.
Kodi 20.x stable release | Skin Confluence (by Jezz_X)
I like editing skins ❤
Reply
#6
Maybe in your grouplist, before...
(2022-11-10, 19:25)alberto1998 Wrote: <control type="label">
<width>525</width>
<height>120</height>
<label>Budget: $INFO[ListItem.Property(Budget)]</label>
<visible>!String.IsEmpty(ListItem.Property(Budget))</visible>
</control>
...you could add an empty button with a number ID (let's say 9999) with 1px height . Then try with <onload>SetFocus(9999)</onload> and see if it works...
If I have helped you or increased your knowledge, please click the 'thumbs up' button to give thanks :)
Reply
#7
Still does not work because the button at the top (set as the first element of the grouplist), once the scrollbar is at the bottom with the set focus on the first button, unfortunately it does not open which is already focused on the first button but opens and goes to the button in top and then show the up animation.

I think it need a function like the one found in all addons like TMDB Helper that when you browse through the various pages, every time you go to the next page, the scollbar goes back to the beginning, how does it work in those panels?

is it just python code or is there also XML?
(to allow it to return the scrollbar to the top and then go down between the various movies)
If i helped you, you can thank me with a thumbs up 👍 below, thanks 🙏.
Kodi 20.x stable release | Skin Confluence (by Jezz_X)
I like editing skins ❤
Reply
#8
@manfeed 

I changed the type of control to use, now I use the spincontrol, but I noticed that it has the same problem as the scrollbar (when you open the window it always returns to the last page viewed), you know a method that works better with the spincontrol than the scrollbar to be able to reset it?

In many skins, such as in conflunece, when closing a panel and reopening it, the spincontrol always returns to page 1, in my dialog window no, I can't understand how, I hope it's not due to python code, or some hidden code, you can to help me in any way?


Thank you for the support 🙏
If i helped you, you can thank me with a thumbs up 👍 below, thanks 🙏.
Kodi 20.x stable release | Skin Confluence (by Jezz_X)
I like editing skins ❤
Reply
#9
If you send me a link with the skin you are working in and explain to me how to reproduce the issue, I could have a look. No promises, since I don’t have a magic wand…
If I have helped you or increased your knowledge, please click the 'thumbs up' button to give thanks :)
Reply
#10
I sent you a private message.

Thank very much, for even giving us a look 🙏
If i helped you, you can thank me with a thumbs up 👍 below, thanks 🙏.
Kodi 20.x stable release | Skin Confluence (by Jezz_X)
I like editing skins ❤
Reply
#11
To reset a Spincontrol insert these lines of code like this:

in the window head:

xml:
<onload condition="String.IsEmpty(Window(Home).Property(ResetScroll))">SetProperty(ResetScroll," ",home)</onload>
<onload condition="!String.IsEmpty(Window(Home).Property(ResetScroll))">ClearProperty(ResetScroll,home)</onload>

in the body, in your textbox, controlled by the spincontrol:

xml:
<control type="textbox">
   <width>525</width>
   <height>100</height>
   <scrolltime>200</scrolltime>
   <pagecontrol>10103</pagecontrol>
   <label>$INFO[your_label] $INFO[Window(home).Property(ResetScroll)]</label>
</control>

xml:
<control type="spincontrol" id="10103">
      <subtype>page</subtype>
</control>


Thanking @manfeed very much.



by helping the community, this thread can be closed, (solved). @Klojum
If i helped you, you can thank me with a thumbs up 👍 below, thanks 🙏.
Kodi 20.x stable release | Skin Confluence (by Jezz_X)
I like editing skins ❤
Reply
#12
Thread marked solved.
Reply

Logout Mark Read Team Forum Stats Members Help
How to reset a state of a dialog window?0