Subj : frame.js scrollbars
To : Nightfox
From : echicken
Date : Wed Nov 25 2015 03:32 pm
> - When first displaying the file, it looks like the scrollbar has "holes" in
> it. This is a screenshot I made as an example (using white as the scrollbar
> foreground and light grey as the scrollbar background):
Not sure. Are you setting the background colour to LIGHTGRAY or BG_LIGHTGRAY?
Is the ANSI content being loaded before or after the scrollbar is opened /
cycled for the first time?
> - I have an input loop in my script that waits for a keypress and scrolls the
> Frame when the user presses the up or down arrow, PageUp, PageDown, Home, or
> End. The scrollbar refreshes when I scroll up & down one line (using the
> Frame's scroll() method), but after using the Frame's scrollTo() method
> (which I'm using for PageUp, PageDown, Home, and End), the scrollbar doesn't
> refresh until cycle() is called a 2nd time (which happens when I press
> PageUp, PageDown, Home, or End in my script).
The ScrollBar doesn't actually redraw itself when you call .cycle() on it; it
just updates its position info. The drawing takes place when .cycle() is
called on the parent Frame. You could try calling .cycle() on the ScrollBar
after you have called Frame.scrollTo() but prior to calling Frame.cycle().
(That may or may not help, but it's worth a shot.)
> For the 2nd issue, I'm not sure if it's something I'm doing wrong in my
> script or if it's an issue in the scrollbar/frame class.
Probably just differences in the way you're using it and the way I expected to
use it. In my input loops, I usually use console.inkey rather than
console.getkey, and call [whatever].cycle() each time through the loop. This
way, stuff gets updated as needed whether the user has pressed a key or not.
(Useful if you want to update stuff in the terminal while the user is idling,
etc.)