Door Games Unlimited

Welcome, Guest.


Subject: frame.js scrollbars Date: Wed Nov 25 2015 20:38:35
From: Nightfox To: echicken

  Re: frame.js scrollbars
  By: echicken to Nightfox on Wed Nov 25 2015 22:56:55

 >> I was using LIGHTGRAY.  I tried BG_LIGHTGRAY just now, and I think it
 >> actually looks/behaves better with LIGHTGRAY.

 ec> Only the BG_* values in sbbsdefs.js should be used for background colours;
 ec> using the others may result in strange-looking things.

 ec> LIGHTGRAY incidentally looks better as a background here because - since
 ec> WHITE is your foreground - it's like not setting a background colour at
 ec> all. The foreground and background colours are OR-ed together to make an
 ec> attribute number. In this case you end up with WHITE|LIGHTGRAY, which is
 ec> 15|7, which is 15, which is WHITE. (You should see the same result when
 ec> using any other non-BG_* colour as your background, so long as WHITE is
 ec> your foreground.) 

Ah, I see.  Perhaps I'll end up changing my script a bit to make things more
the way they're supposed to be then.

 >> The ANSI content is being loaded before the scrollbar & frame are
 >> opened for the first time.  Should it be loaded after?

 ec> Not sure - I was just curious. How are you loading the ANSI stuff into the
 ec> Frame - using Frame.load(), or some other way (Frame.putmsg(), etc.)?

I'm using Frame.load() to load an ANSI file.

 >> Ah, that seems to help.  So it seems that the documentation (comments)
 >> in scrollbar.js are wrong - 

 ec> Not really. The example works, but there's a crucial difference between it
 ec> and what you're doing. (Which isn't to say that your way is wrong.)

 >> if(f.cycle()) {
 >>   s.cycle();
 >>   console.gotoxy(console.screen_columns, console.screen_rows);
 >> }
 >> That seems to suggest that if the frame cycle succeeds, then cycle the
 >> scrollbar.  But as you suggested, it seems to work better when the
 >> scrollbar's cycle() is called before the frame's cycle().

 ec> Frame.cycle() returns true if something changed, false otherwise. In my
 ec> example, I'm only updating the ScrollBar if something changed in the Frame
 ec> it's attached to. However changes to the ScrollBar's position won't be
 ec> displayed until the Frame is cycled again. In my example, that next
 ec> Frame.cycle() happens right away. In your code, there's presumably a
 ec> blocking input prompt (console.getkey perhaps) in between.

Ah, I see.  I suppose that is a little different from what I am doing.

 ec> The best solution would be for me to just bring ScrollBar into frame.js,
 ec> and tie it into the Frame.cycle() method. Then you would use those
 ec> currently-placeholder properties of Frame to enable scrollbars, and the
 ec> rest would work behind the scenes - no need to manage the scrollbars
 ec> separately. 

Would that break existing scripts that are currently managing them separately?

Nightfox

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

Previous Message       Next Message
In Reply To: frame.js scrollbars (echicken)
Replies: frame.js scrollbars (echicken)