BBC BASIC for Windows
Programming >> User Interface >> Scrolling
http://bb4w.conforums.com/index.cgi?board=ui&action=display&num=1376182299

Scrolling
Post by Ken Down on Jun 14th, 2013, 11:16am

I'm probably teaching my grandmother to suck eggs, but I had a program that scrolled a window and displayed pictures as you scrolled. It was all very slow and eventually I realised that for every click on the scrollbar, the program redrew the pictures twice.

After a lot of mucking about - I guess I'm not one of your top-flight programmers - I finally found the problem.

I had:
DEFPROCscroll(msg%,wp%)
CASEmsg%OF
WHEN277
CASEwp%AND&FFFFOF
WHEN0
WHEN1
ENDCASE
SYS"SetScrollPos",@hwnd%,1,vscroll%,1
PROCupdate
ENDCASE
ENDPROC

What I didn't realise was that you can get the msg% of 277 with values other than the permitted 0,1,2,3,5. In fact, 8 is what I was getting.

So now my routine reads

DEFPROCscroll(msg%,wp%)
CASEmsg%OF
WHEN277
CASEwp%AND&FFFFOF
WHEN0tongueROCupdate
WHEN1tongueROCupdate
ENDCASE
SYS"SetScrollPos",@hwnd%,1,vscroll%,1
ENDCASE
ENDPROC

(There is, of course, more code after the WHEN0 etc, setting vscroll% by a suitable amount.)

I hope this helps others who may be as dense as me.