[futurebasic] Re: [FB] page up & page dn keys

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : June 1999 : Group Archive : Group : All Groups

From: Greg_Neagle@... (Greg Neagle)
Date: Tue, 22 Jun 1999 08:55:32 -0700
On 6/21/99 at 7:52 PM, larry1008@... wrote:

:When trapping the page up and page down keys to scroll an edit field with 
:an attached scroll bar, is there a better or more elegant way of moving 
:the edit field contents than using TESCROLL and setting the scroll bar 
:value? Is there some function call that simulates a click in the scroll 
:bar?

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 scroll
bar?
      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


- sent via BulkRate (http://members.aol.com/gregneagle/bulkrate/)