• Frame and Scrollbar issue when re-using them

    From Nightfox@VERT/DIGDIST to All on Tue Jan 10 21:44:56 2017
    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@VERT/ECBBS to Nightfox on Wed Jan 11 08:37:03 2017
    Re: Frame and Scrollbar issue when re-using themã By: Nightfox to All on Tue Jan 10 2017 21:44:56ãã Ni> I'm working on a Synchronet JS door that uses the Frame and Scrollbarã Ni> objects defined in frame.js and scrollbar.js. My door, a voting door, hasãã Ni> time I re-use it for new data. I've noticed that the scrollbar doesn'tã Ni> always seem to update properly with the length of the message in theã Ni> 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.ãã Ni> Then my script enters the loop, where displayFrame.putmsg() is called forã Ni> each piece of data I want to display. When I display the Frame, I callã Ni> displayFrame.invalidate(), displayFrameScrollbar.cycle(), andã Ni> displayFrame.cycle().ãã Ni> 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@VERT/DIGDIST to echicken on Wed Jan 11 11:17:16 2017
    Re: Frame and Scrollbar issue when re-using themã By: echicken to Nightfox on Wed Jan 11 2017 08:37 amãã ec> I haven't looked at scrollbar.js in a while, but I haven't seen thisã ec> problem with it before. I'll take a peek at how SlyVote is using it (ifã ec> 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@VERT/ECBBS to Nightfox on Wed Jan 11 14:52:36 2017
    Re: Frame and Scrollbar issue when re-using themã By: echicken to Nightfox on Wed Jan 11 2017 08:37:03ãã Ni>> time I re-use it for new data. I've noticed that the scrollbarã Ni>> doesn't always seem to update properly with the length of theã Ni>> 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@VERT/ECBBS to Nightfox on Wed Jan 11 15:42:01 2017
    Re: Frame and Scrollbar issue when re-using themã By: Nightfox to echicken on Wed Jan 11 2017 11:17:16ãã Ni> What seems to be happening is that if I put a fairly short message intoã Ni> the frame, then a longer message (where it needs to scroll), then anotherã Ni> short message, the frame will still scroll down and the scrollbar actsã Ni> 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.ãã Ni> of the message is blank where the longer message was. Do you know of a wayã Ni> to clear the frame of all of its data before putting a new message intoã Ni> 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@VERT/DIGDIST to echicken on Wed Jan 11 18:54:00 2017
    Re: Frame and Scrollbar issue when re-using themã By: echicken to Nightfox on Wed Jan 11 2017 03:42 pmãã Ni>> What seems to be happening is that if I put a fairly short messageã Ni>> into the frame, then a longer message (where it needs to scroll),ã Ni>> then another short message, the frame will still scroll down and theã Ni>> scrollbar acts accordingly, as if the longer message was stillã Ni>> there, but the bottom part ãã ec> 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ã