Charles Poole wrote: > > Is there a way to link the arrow keys to a scroll bar that is linked > > to an edit field? > > Charles, > > While this could be done in FB's event handler, it might be easier > to intercept the arrow keys in the dialog handler. Everyone: Please forget my last post. Charles, When a scroll bar is linked to an Edit Field as I did in the example code, its action is automatic. You don't need to intercept anything. FB does it for you and the arrow keys just work. My code would be okay for a stand-alone scroll button like you were doing in your event code, but when you link and edit field with a its related scroll button, it's designed to work with no overhead. Sleep deprivation. In an attempt to redeem myself, I am including a demo of what I should have done in the first place. I will hibernate now. Ken /* Scroll button with arrow keys Ken Shmidheiser August 17, 2007 */ _scrollInitial = 50 _scrollMin = 0 _scrollMax = 100 _scrollPage = 5 _scrollBtn = 1 _positionEF = 1 local fn BuildWindow dim as rect r setrect( r, 0, 0, 100, 400 ) appearance window 1, "", @r,¬ _kDocumentWindowClass,¬ _kWindowCloseBoxAttribute def SetWindowBackground(_kThemeActiveDialogBackgroundBrush, _zTrue ) setrect( r, 41, 10, 59, 350 ) scroll button _scrollBtn,¬ _scrollInitial,¬ _scrollMin,¬ _scrollMax,¬ _scrollPage,¬ @r,¬ _scrollOther color = _zRed text _applFont, 16 setrect( r, 0, 365, 92, 385 ) edit field _positionEF, str$( _scrollInitial ),¬ @r, _statNoFramed, _centerJust end fn local fn DoDialog dim as long evnt, id dim as long thumb, current dim as long min, max evnt = dialog( 0 ) id = dialog( evnt ) /* Assign constants to arrow keys */ _upArrow = 30 _downArrow = 31 select case ( evnt ) case _btnClick select case ( id ) case _scrollBtn /* Update position field when scroll button is moved */ edit$( _positionEF ) = str$( button( _scrollBtn ) ) end select /* Look at key presses... */ case _evkey /* ... checking for up and down arrow key presses */ long if ( id = _upArrow or id = _downArrow ) /* Get current position of EF's scroll button thumb */ thumb = button( _scrollBtn ) select case ( id ) /* Assign up arrow key press */ case _upArrow if thumb > button( _scrollBtn,¬ _FBGetCtlMinimum ) then thumb-- /* Assign down arrow key press */ case _downArrow if thumb < button( _scrollBtn,¬ _FBGetCtlMaximum ) then thumb++ end select /* Set scroll button thumb to new value */ scroll button _scrollBtn, thumb edit$( _positionEF ) = str$( thumb ) end if case _wndclose : end end select end fn on dialog fn DoDialog fn BuildWindow do handleevents until gFBQuit end