Reset textbox to the top
#1
Hi all, please can you tell me the way to reset text box to the top on reload in dialog window?
The textbox is controlled by scrollbar and autoscroll, the problem is that it does not reset to the top on dialog close and re-open.
I believe that it's something easy that I just missed.
Below the code:
PHP Code:
<control type="textbox" id="401">
                    <
description>Plot value</description>
                    <
left>46</left>
                    <
top>370</top>
                    <
width>1390</width>
                    <
height>342</height>
                    <
font>font14_textbox</font>
                    <
align>justify</align>
                    <
textcolor>grey</textcolor>
                    <
shadowcolor>shadow</shadowcolor>
                    <
pagecontrol>62</pagecontrol>
                    <
autoscroll time="3000" delay="4000" repeat="5000">Skin.HasSetting(Enable.AutoScroll)</autoscroll>
                    <
label fallback="161">$INFO[VideoPlayer.NextPlot]</label>
                </
control>
                <
control type="scrollbar" id="62">
                    <
showonepage>true</showonepage>
                    <
left>1450</left>
                    <
top>370</top>
                    <
height>340</height>
                    <
width>8</width>
                    <
onup>PageUp(401)</onup>
                    <
ondown>PageUp(401)</ondown>
                    <
onleft>Skin.ToggleSetting(ToggleLiveTVNext)</onleft>
                    <
onright>Skin.ToggleSetting(ToggleLiveTVNext)</onright>
                    <
onleft>Control.SetFocus(61)</onleft>
                    <
onright>Control.SetFocus(61)</onright>
                    <
texturesliderbackground />
                    <
texturesliderbar colordiffuse="55ffffff" border="1">scrollbar/texturesliderbar2.png</texturesliderbar>
                    <
texturesliderbarfocus border="1">scrollbar/texturesliderbar2.png</texturesliderbarfocus>
                    <
orientation>vertical</orientation>
                </
control

Thanks for help.
Reply
#2
Any one please? Is there any more info that I need to provide?
Reply
#3
I've got the same problem here... I'd like to reset a scrolling textbox when unloading the window or dialog. Once I open the same dialog or window again, it'll continue scrolling right where it left off. Only if the same dialog is opened again for a different container/list item, the scrolling is reset. How to solve this?
OSMC Skinner      |    The OSMC Skin for Kodi v20 Nexus (native 16:9, 21:9 and 4:3 skin, special cinemascope/CIH version available)      |     GitHub: https://github.com/Ch1llb0/skin.osmc
Reply
#4
Afaik there is only one workaround. Try adding this to the window header:

Code:

<onload>PageUp(401)</onload>
<onload>PageUp(401)</onload>
<onload>PageUp(401)</onload>
<onload>PageUp(401)</onload>
<onload>PageUp(401)</onload>
<onload>PageUp(401)</onload>
<onload>PageUp(401)</onload>
<onload>PageUp(401)</onload>
<onload>PageUp(401)</onload>
<onload>PageUp(401)</onload>
<onload>PageUp(401)</onload>
<onload>PageUp(401)</onload>
<onload>PageUp(401)</onload>
<onload>PageUp(401)</onload>
<onload>PageUp(401)</onload>
<onload>PageUp(401)</onload>
<onload>PageUp(401)</onload>
<onload>PageUp(401)</onload>
<onload>PageUp(401)</onload>
<onload>PageUp(401)</onload>
Main: Lancool II Mesh  - Ryzen 9 5900x - MSI x570 Unify - Zotac RTX 3080 AMP HOLO - 32GB Trident Z Neo 3600 CL16 -  EVO 960 M.2 250GB / EVO 940 250GB / MX100 512GB /  Crucial P1 2TB / WD Blue 3D Nand 2TB 
Sound: Saxx AS30 DSP - Beyer Dynamic Custom One Pro 
TV: Nvidia Shield 2019 Pro- Adalight 114x LEDs - Sony 65XG9505 - Kodi / Emby - Yamaha RX-V683 - Heco Victa 700/101/251a + Dynavoice Magic FX-4
Server: i3 Skylake - 8GB - OMV4 - 22TB Storage
Reply
#5
I've tried this, but without a scrollbar present, it doesn't seem to work. My plot texts don't have scrollbars and therefore this is quite frustrating... Why would textboxes scroll, even if they're not visible or focused? And why don't they reset to the top automatically when closing the dialog or window they're part of? No Seems to be absolutely logical to me that they should to exactly that.
OSMC Skinner      |    The OSMC Skin for Kodi v20 Nexus (native 16:9, 21:9 and 4:3 skin, special cinemascope/CIH version available)      |     GitHub: https://github.com/Ch1llb0/skin.osmc
Reply
#6
In case someone is interested, I've found a way to get it, it's a dirty hack but at least it works... It requires to add this two lines to the window header...
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>

...after that you'll have to add that property to all your textbox controls with autoscroll in that window...

xml:

<control type="textbox">
<autoscroll delay="5000" time="2000" repeat="5000">Skin.HasSetting(Enable.AutoScroll)</autoscroll>
<left>595</left>
<top>112</top>
<width>580</width>
<height>415</height>
<aligny>top</aligny>
<font>font15d</font>
<label>$INFO[ListItem.Property(Artist_Description)]$INFO[Window(home).Property(ResetScroll)]</label>
</control>

...that makes that property shift in every window load betweeen empty and a blank space. As a consequence it makes the autoscroll reset, since the content of the textbox has changed compared to the previous time. The only downside is that one in two times you'll have a blank space added to the end of your textbox, other than to have to add the additional code, of course...

EDIT. I've found that in some windows (DialogMusicInfo.xml when using it for songs info) the above method didn't work, since for some reason the onload conditions aren't evaluated (but they are when using it for artist info and album info... Kodi and its mysteries  Rofl ) so I devised another option to the window header...

xml:

<onload>SetProperty(ResetScroll," ",home)</onload>
<onload>AlarmClock(ClearValue,ClearProperty(ResetScroll,home),00:01,silent)</onload>

This method has the advantage that works for all cases and doesn't add anything to the textbox, since the additional space gets removed after 1 second.
If I have helped you or increased your knowledge, please click the 'thumbs up' button to give thanks :)
Reply
#7
This is a brilliant workaround! I had looked at adding some sort of toggling blank before, but was simply not able to figure out the double quote way of doing it. This is the next best thing to an actual textbox control tag enabling us skinners to toggle scroll reset on focus... Thank you, @manfeed!
OSMC Skinner      |    The OSMC Skin for Kodi v20 Nexus (native 16:9, 21:9 and 4:3 skin, special cinemascope/CIH version available)      |     GitHub: https://github.com/Ch1llb0/skin.osmc
Reply
#8
I have edited my previous post with another method best suited for some cases...
If I have helped you or increased your knowledge, please click the 'thumbs up' button to give thanks :)
Reply

Logout Mark Read Team Forum Stats Members Help
Reset textbox to the top0