• Frame and Scrollbar issue when re-using them

    From Nightfox@DIGDIST to All on Tuesday, January 10, 2017 21:44:56
    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
  • From echicken@ECBBS to Nightfox on Wednesday, January 11, 2017 08:37:03
    Re: Frame and Scrollbar issue when re-using them
    By: Nightfox to All on Tue Jan 10 2017 21:44:56

    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

    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.

    I haven't looked at scrollbar.js in a while, but I haven't seen this problem with it before. I'll take a peek at how SlyVote is using it (if these changes are in CVS) to see if I can think of any ideas.

    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().

    longer than the terminal height). For screen redraw optimization, I'd like

    It shouldn't be necessary to invalidate a Frame every time through the loop. In fact if you do that, you lose any screen redraw optimization since
    (IIRC) this will force the contents of the Frame to be redrawn / resent to the client. (I've found it necessary to use Frame.invalidate() on occasion, can't remember why, but not usually in a loop.)

    In the ScrollBar example, ScrollBar.cycle() is called after Frame.cycle(). I can't remember if this is for a reason, but it may be. However, in that case the changes to the ScrollBar won't be displayed until the next time the parent Frame is cycled. Depending on how your loop works and if there's a blocking input prompt in there, that could be part of it.

    ---
    echicken
    electronic chicken bbs - bbs.electronicchicken.com - 416-273-7230
    ■ Synchronet ■ electronic chicken bbs - bbs.electronicchicken.com
  • From Nightfox@DIGDIST to echicken on Wednesday, January 11, 2017 11:17:16
    Re: Frame and Scrollbar issue when re-using them
    By: echicken to Nightfox on Wed Jan 11 2017 08:37 am

    I haven't looked at scrollbar.js in a while, but I haven't seen this problem with it before. I'll take a peek at how SlyVote is using it (if these changes are in CVS) to see if I can think of any ideas.

    What seems to be happening is that if I put a fairly short message into the frame, then a longer message (where it needs to scroll), then another short message, the frame will still scroll down and the scrollbar acts accordingly, as if the longer message was still there, but the bottom part of the message is blank where the longer message was. Do you know of a way to clear the frame of all of its data before putting a new message into it?

    Nightfox

    ---
    ■ Synchronet ■ Digital Distortion: digitaldistortionbbs.com
  • From echicken@ECBBS to Nightfox on Wednesday, January 11, 2017 14:52:36
    Re: Frame and Scrollbar issue when re-using them
    By: echicken to Nightfox on Wed Jan 11 2017 08:37:03

    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

    The latest change to frame.js should solve this problem. I may need to make a small change to scrollbar.js yet, just trying to track down a bug.

    ---
    echicken
    electronic chicken bbs - bbs.electronicchicken.com - 416-273-7230
    ■ Synchronet ■ electronic chicken bbs - bbs.electronicchicken.com
  • From echicken@ECBBS to Nightfox on Wednesday, January 11, 2017 15:42:01
    Re: Frame and Scrollbar issue when re-using them
    By: Nightfox to echicken on Wed Jan 11 2017 11:17:16

    What seems to be happening is that if I put a fairly short message into the frame, then a longer message (where it needs to scroll), then another short message, the frame will still scroll down and the scrollbar acts accordingly, as if the longer message was still there, but the bottom part

    Yep, this has been fixed, along with a couple of other things.

    of the message is blank where the longer message was. Do you know of a way to clear the frame of all of its data before putting a new message into it?

    Frame.clear() does that now; it was doing something a bit different before.

    ---
    echicken
    electronic chicken bbs - bbs.electronicchicken.com - 416-273-7230
    ■ Synchronet ■ electronic chicken bbs - bbs.electronicchicken.com
  • From Nightfox@DIGDIST to echicken on Wednesday, January 11, 2017 18:54:00
    Re: Frame and Scrollbar issue when re-using them
    By: echicken to Nightfox on Wed Jan 11 2017 03:42 pm

    What seems to be happening is that if I put a fairly short message
    into the frame, then a longer message (where it needs to scroll),
    then another short message, the frame will still scroll down and the
    scrollbar acts accordingly, as if the longer message was still
    there, but the bottom part

    Yep, this has been fixed, along with a couple of other things.

    Thanks - I updated my frame.js and scrollbar.js and it seems to be fixed.

    Nightfox

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