Here's what I use in my Extended Keyboard.FLTR:
LOCAL FN scrollPage(direction)
DIM t,l,b,r
DIM currEF, btnHndl&
DIM efH&, fntHt, pg, thumb
DIM x$
currEF = WINDOW(_efNum)
btnHndl& = BUTTON&(currEF)
LONG IF btnHndl& 'is there a button with the same id as the edit field?
LONG IF btnHndl&..contrlMax% > btnHndl&..contrlMin%' is it a scrollbar?
efH& = TEHANDLE(currEF)
LONG IF efH&
t;8 = [efH&] + _teViewRect
REM is the top left of the scroll bar close to the top right of the edit field?
LONG IF (ABS(btnHndl&..contrlRect.top% - t) < 5 AND ABS(btnHndl&..contrlRect.left% - r) < 5) ¬
OR currEF = 8001
fntHt = USR FONTHEIGHT
pg = ((b-t) - fntHt)/fntHt
thumb = BUTTON(currEF)
thumb = thumb + pg*SGN(direction)
IF thumb < btnHndl&..contrlMin% THEN thumb = btnHndl&..contrlMin%
IF thumb > btnHndl&..contrlMax% THEN thumb = btnHndl&..contrlMax%
SCROLL BUTTON currEF,thumb,,,pg 'reset pg up/down
END IF
END IF
END IF
END IF
END FN