Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- FreshWin (c) Fresh Technologies - <b>sbgetevent() scroll bar function</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  SBGETEVENT()                                           Scroll Bar Function
 Purpose..: Get an event for a vertical and/or horizontal bar
-------------------------------------------------------------------------------
 Syntax...: sbGetEvent( [<aVBar>], [<aHBar>],
                        [<nKey>], [<nPress>],
                        [<nMsX>], [<nMsY>] ) --> nEvent

 Arguments: [<aVBar>]     = vertical scroll bar.

            [<aHBar>]     = horizontal scroll bar.

            [<nKey>]      = key action from which an event is to
                            be returned.

            [<nPress>]    = mouse press to derive an event.

            [<nMsX>]      = row of mouse press. Defaults to the
                            current mouse row.

            [<nMsY>]      = column of mouse press. Defaults to the
                            current mouse column.

 Returns..: <N> nEvent is the keyboard/mouse event returned.

            If <nKey> or <nPress> is NOT specified, sbGetEvent() will
            look into the key buffer with inkey() and into the mouse
            buffer with MsStatus(). Sometimes, however, it is desirable
            to provide your own key and mouse handler. Thus,
            <nKey> and <nPress> can be passed. If not passed, you
            can still find the key that was processed by
            sbGetEvent() by testing lastkey(). The result, nEvent,
            is as follows:

            Event Translate Directive as found in FW_SCROLL.CH
            --------------------------------------------------------------
            FW_SCROLL       Description
            --------------------------------------------------------------
            Constant        Type       Key Press    Mouse Press
            --------------------------------------------------------------
            SB_IDLE         BOTH       no activity  no activity
            SB_LINEUP       BOTH       K_UP         decrement control
            SB_LINEDOWN     BOTH       K_DOWN       increment control
            SB_PGUP         BOTH       K_PGUP       before thumb character
            SB_PGDN         BOTH       K_PGDN       after thumb character
            SB_RIGHT        BOTH       K_RIGHT      increment control
            SB_LEFT         BOTH       K_LEFT       decrement control
            SB_PANRIGHT     H_SCROLL   N/A          after thumb character
            SB_PANLEFT      H_SCROLL   N/A          before thumb character
            SB_THUMBTRACK   BOTH       N/A          dragging thumb
            SB_TOP          BOTH       CTRL-PGUP    N/A
            SB_BOTTOM       BOTH       CTRL-PGDN    N/A
            SB_HOME         BOTH       HOME         N/A
            SB_END          BOTH       END          N/A
            --------------------------------------------------------------

 Source...: SCRLBAR.PRG
-------------------------------------------------------------------------------
 Example..: . The example gets a scroll event for a vertical and
              horizontal scroll bar.

             nKey := MsInKey( 0, @nPress )
             MsStatus( , @nX, @nY )
             nStatus := sbGetEvent( aVSB, aHSB, nKey, nPress, nX, nY )

             if nStatus == SB_LINEUP
                ++nCurrent
                sbSetPos( aVertSB, nCurrent )
             endif

See Also: sbNew()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson