mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jul 2006
Posts: 4,145
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
When you have an edit control associated to a tab with a vertical scrollbar, adding to such an edit control while scrolled up with the tab active will make the control scroll down automatically.
However, if the tab is inactive, it does not scroll down automatically, and there doesn't seem to be a good way to workaround this, I don't think it's intended, if it is we would need a way to force the scrollbar to go down.
Note also that if the scroll is already down and the tab is inactive, it will scroll up and won't keep the scroll down.

Code
dialog tests {
  size -1 -1 200 200
  tab "noedit ", 1, 2 2 198 198
  tab "edit", 2
  edit "", 3, 5 30 190 160, tab 2 read multi vsbar
}
on *:dialog:tests:init:*:var %a 20 | while (%a) { did -a tests 3 line $+ %a $+ $crlf | dec %a }

1) /dialog -om tests tests
2) go to the 'edit' tab, scroll the control up
3) execute "/did -a tests 3 line0 $+ $crlf" and see the scrollbar going down automatically.
4) scroll the control up again, make the first tab the active tab
5) "/did -a tests 3 line-1 $+ $crlf" and this time the control is still scrolled up.
6) you may repeat 4) & 5) again with the scroll being down already this time, to see it moving up.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Dec 2002
Posts: 5,411
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,411
Thanks for your bug report. This is due to how an editbox behaves when it is visible/hidden and the cursor location changes. I could make /did -a always scroll text to the bottom even when a control is hidden. However, this does mean that existing scripts that fill hidden editboxes with text before making them visible will now find the cursor at the end of the text instead of at the top. On the other hand, I would prefer for /did -a to work consistently, instead of having to add a new switch just for this behaviour. Hmm.

Joined: Jul 2006
Posts: 4,145
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
A switch could be an idea because there are other ways to add to a control than did -a, there's did -i, -o, /filter, it could also allow scripters to provide an actual way to scroll down even without adding anything to the control if the user is scrolled up, like the mirc forums have a 'top' button' to scroll up in web page.

Note also that having a switch would allow us to keep the scroll as it is when text is being added to the control while the dialog/control is active and you're scrolled up reading text, like in a chat system (channel scrollbar), you don't want the scroll to go down automatically in this case, but scripting this would probably require accessing the scrollbar status: scrolled up, scrolled down, or like scrolled middle or something.

I realize this may be trickier than it seems, but I'm definitely looking for the same behavior as the channel scrollbar, if you're scrolled up, new lines being added won't scroll down, and if you're scrolled down, it will scroll down, all of this regardless if the window/tab/control is active or not.

Last edited by Wims; 28/10/21 08:30 PM.

#mircscripting @ irc.swiftirc.net == the best mIRC help channel

Link Copied to Clipboard