Subj : Frame and Scrollbar issue when re-using them
To   : All
From : Nightfox
Date : Tue Jan 10 2017 09:44 pm

I'm working on a Synchronet JS door that uses the Frame and Scrollbar objects
defined in frame.js and scrollbar.js.  My door, a voting door, has an option to
let the user view all voting results, and I wanted to use the Frame object
since it allows scrolling (in case there is a poll that is longer than the
terminal height).  For screen redraw optimization, I'd like to re-use the Frame
and Scrollbar objects, calling Frame.putmsg() each time I re-use it for new
data.  I've noticed that the scrollbar doesn't always seem to update properly
with the length of the message in the frame.  I'm wondering if I'm not using it
properly though.

What I'm doing in my door is creating the Frame & Scrollbar, and then it has a
loop where it populates the Frame, displays it, and gets input from the user
(such as go to previous/next, scroll up/down, quit, etc.).

This is how I'm creating the Frame & Scrollbar objects:

var displayFrame = new Frame(1,
                         displayMsgHdrUnmodified.length + 1,
                         console.screen_columns,
                         frameHeight,
                         BG_BLACK);
displayFrame.v_scroll = true;
displayFrame.h_scroll = false;
displayFrame.scrollbars = true;
var displayFrameScrollbar = new ScrollBar(displayFrame, {bg: BG_BLACK, fg:
                                         LIGHTGRAY, orientation: "vertical",
                                         autohide: false});

Then my script enters the loop, where displayFrame.putmsg() is called for each
piece of data I want to display.  When I display the Frame, I call
displayFrame.invalidate(), displayFrameScrollbar.cycle(), and
displayFrame.cycle().

Nightfox

---
� Synchronet � Digital Distortion: digitaldistortionbbs.com