BBC BASIC for Windows
Programming >> User Interface >> Scrolling http://bb4w.conforums.com/index.cgi?board=ui&action=display&num=1272700985 Scrolling
Post by nitwit on May 1st, 2010, 08:03am
Vertical scrolling is fairly easy. Between the PDF manual page 795 and example VSCROLL its done although I don't know why 'columns' are needed.
Horizontal scrolling is trickier, some hints but my solution is to use VDU30 and reprint to the whole screen taking into account the 'columns'. Is that right? (I don't really want to think about VDU23,7).
Where is this going? Well it doesn't seem to matter whether you have to scroll 500 lines or 5 lines the slider is the same size. I want a bigger slider for short scrolls. How do I do that?
Re: Scrolling
Post by admin on May 1st, 2010, 9:49pm
I want a bigger slider for short scrolls. How do I do that?
You need a 'new style' scroll bar (variable thumb-box size) rather than an 'old style' scroll bar (fixed thumb-box size). Using SetScrollPos results in the old style scroll bar, using SetScrollInfo results in the new style scroll bar.
For an example of using SetScrollInfo see the supplied example program SCROLL.BBC (in the EXAMPLES\GENERAL folder).
Richard.
Re: Scrolling
Post by nitwit on May 21st, 2010, 6:32pm
Yes, that gives me the sliders I want BUT there appears to be a conflict with MULTIWIN. Scrolling (main window only) does not work any more when this is added to the program. Advice please.
Re: Scrolling
Post by admin on May 21st, 2010, 9:49pm
Yes, that gives me the sliders I want BUT there appears to be a conflict with MULTIWIN. Scrolling (main window only) does not work any more when this is added to the program. Advice please.
I can't reproduce the effect. I've tried adding a vertical scroll bar to the main window in MULTIDEM.BBC, and the ON MOVE scroll events are received normally.
However, using MULTIWIN undoubtedly makes your life more difficult, because of the way it changes the value of @hwnd% 'on the fly'. Both the supplied scroll bar examples (VSCROLL.BBC and SCROLL.BBC) assume that @hwnd% is constant - as it is in all normal circumstances - so extra care is needed if you try to combine them with MULTIWIN.
If there's any way you could avoid the use of MULTIWIN, e.g. by using a dialogue box instead, it would make the implementation of scroll bars more straightforward (@hwnd% would be constant again).
Richard. Re: Scrolling
Post by nitwit on May 24th, 2010, 5:46pm
VSCROLL works fine with MULTIWIN (even after I adapted it to do horizontal scrolling as well as vertical).
With SCROLL (to add a bit more info.), the sliders are the right size and do move but no scrolling takes place. The problem seems to be the line in MULTIWIN SYS"SetWindowLong"",@hwnd%,-4,M% (near the bottom of DEF_PROCmultwin(Q%). If I REM this, then scrolling works fine BUT printing to the 'other' windows goes wrong.
Any ideas before I revert to VSCROLL? Re: Scrolling
Post by admin on May 24th, 2010, 9:56pm
The problem seems to be the line in MULTIWIN SYS"SetWindowLong"",@hwnd%,-4,M% (near the bottom of DEF_PROCmultwin(Q%). If I REM this, then scrolling works fine
You MUST NOT disable that line; it's fundamental to the correct operation of MULTIWIN. Indeed, don't ever mess around with the code in a library unless you understand exactly what it does.
Anyway, your problem is probably related to the fact that MULTIWIN disables the action of the @ox% and @oy% offsets, which SCROLL.BBC relies upon. Although it would be possible to modify MULTIWIN.BBC to enable those offsets, it's not straightforward.
Using MULTIWIN to create additional output windows whilst using the @ox%/@oy% offset facility on the main window is something I never envisaged! I've updated the library documentation to make the limitation clear:
You only need to use MULTIWIN if you are outputting standard BBC BASIC text or graphics to the child windows. If not, there are alternative ways to create child windows which won't interfere with the offsets. For example you could create them using WINLIB5, or use a dialogue box.
Of course, even if you decide to base your code on VSCROLL.BBC you can still have 'proportional' scroll bars of the sort that SCROLL.BBC provides. The style of scroll bar is unrelated to the method used for scrolling.