Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- TSDWIN: Clipper 5.0 Interface Library - Norton Guide http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]

 twAMButtonPress( nButton, aRegions, aColor )
 ----------------------------------------------------------------------------
     Determine if a particular mouse button has been pressed within an
     array of defined regions. If it has, display the click area in an
     exception colour and execute an optional code block defined to be
     executed for that region. The region information is stored within
     TSDWIN.

       Arguments:

     nButton  - 'N' Button number to check. ( 0 for left, 1 for right,
                    2 for both ).

     aRegions - 'A' An array of regions consisting of array elements
                    each of which is an array of up to 5 elements, four
                    for the region coordinates and the fifth for an
                    optional code block to execute.

     aColor   - 'A' Two element array containing the colours to be used
                    when the mouse cursor is in the region and another
                    to use when a press occurs:

                        { cClick, cRegion }

       Return:

     The element number of the region in which a press occurred or zero
     if no presses  occurred in regions within the region array.

       Example:

     LOCAL aRegions, nRegion := 0, nLRegion := 1
     LOCAL nStdClr, nEnhClr, nKey := 0, nKRegion

     aRegions := { ;
        { twRow( 02 ), twCol( 05 ), ;
          twRow( 02 ), twCol( 13 ), ;
          {|| twMGetYorn( "Display Button 1 Pressed" )} }, ;
        { twRow( 04 ), twCol( 05 ), ;
          twRow( 04 ), twCol( 13 ), ;
          {|| twMGetYorn( "Display Button 2 Pressed" )} }, ;
        { twRow( 06 ), twCol( 05 ), ;
          twRow( 06 ), twCol( 13 ), ;
          {|| twMGetYorn( "Display Button 3 Pressed" )} }}

     twMSetRegions( aRegions )

     DO WHILE INKEY() != K_ESC
        twMPause( .02 )

        // Check regions for presence of mouse
        twAMButtonPress( 1, aRegions, { "r+/*gr", "gr+/r" } )

        IF ( nRegion := twAMFound()) > 0 ;
                .AND. ( nRegion != nLRegion )
                _twM2()

                tw_VAttr( aRegions[ nRegion, 1 ], ;
                        aRegions[ nRegion, 2 ], ;
                        aRegions[ nRegion, 3 ], ;
                        aRegions[ nRegion, 4 ] , nEnhClr )

                tw_VAttr( aRegions[ nLRegion, 1 ], ;
                        aRegions[ nLRegion, 2 ], ;
                        aRegions[ nLRegion, 3 ], ;
                        aRegions[ nLRegion, 4 ] , nStdClr )
                nLRegion := nKRegion := nRegion
                nRegion  := 0
                _twM1()
        ENDIF

        // Check QUIT
        IF twMClickShow( 1, twRow( 13 ), twCol( 30 ),;
                                twRow( 13 ), twCol( 47 ))
                _twM2()
                KEYBOARD K_ESC
        ENDIF
     ENDDO

See Also: _twM3B() twMBPress()

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