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]

 twQDBrowse( wT, wL, wB, wR, aColumns, xTitle, ;
               wColor, wSType, wFType, wFColor, nFreeze, ;
               aSrch, lAlite )
 ----------------------------------------------------------------------------
     twQDBrowse() is a small browse being used using a new  search
     mechanism. The highlight bar carries the search string if it is
     chosen. This function has no mouse support at present. It is
     useful for creating picklists.

     The TBrowse processes the following keys:

                Up Arrow ---------+
                Down Arrow        |
                Left Arrow        |
                Right Arrow       |
                Page Down         |- Scroll the Highlight Bar in
                Page Up           |  the normal way.
                Ctrl Page Down    |
                Ctrl Page Up      |
                Ctrl Left Arrow   |
                Ctrl Right Arrow  |
                Ctrl Home         |
                Ctrl End ---------+

                Escape         - Exit with no choice.
                Enter          - If EditFlag is .T., allow editing of
                                 the current field in the current
                                 record, otherwise, exit the browse.
                Delete         - Mark the current record for deletion.
                Alpha Keys     - Speed Search with display of key.
                Back Space     - Reset Search String to empty. Any
                                 cursor key movement which moves the
                                 record pointer will also reset the
                                 search string.

       Arguments:

     wT, wL     - 'N' Screen coordinates for the display
     wB, wR           window.

     aColumns   - 'A' An array containing as its elements the TBrowse
                      columns to display. If this parameter is not
                      passed, it defaults to creating columns for every
                      field in the currently selected database file.

     xTitle     - 'C or A' Header for the display window. The default is
                      NIL. If an array is passed, you may specify the
                      title  colour and position, otherwise the title
                      is displayed in the Clipper standard colour
                      centered on the top line of the window.

                      If you want to pass a title array, it  must be of
                      the form:

                        { Title String,;
                          Title  Colour,;
                          Title row ( "B" or "T" ),;
                          Title justification ( "R", "C", or "L" ) }

                      If you are NOT using the bar highlight search
                      mechanism, the BOTTOM LEFT position is used to
                      display the current search string.

     wColor     - 'C' Clipper colour string. Defaults to SETCOLOR(). It
                      is suggested that you pass a colour string with
                      the Clipper background colour set. If you do,
                      that colour is used for frozen columns.

     wSType     - 'N' TSDWIN shadow type. Defaults to no shadow.

     wFType     - 'N' TSDWIN frame type. Defaults to single line box.

     wFColor    - 'C' Optional border colour. Can be used to make the
                      active window, in this case the browse, have a
                      different border colour from other windows.

     nFreeze    - 'N' Number of columns to freeze initially. The
                      default is zero.

     aSrch      - 'A' Five element array which defines the search key
                      handling. aSrch must have the structure:

                      aSrch := { Column number on which to search, ;
                                 Optional colour for the highlight
                                     bar search string display,;
                                 Optional code block for search the
                                     database,;
                                 Optional mask for the search
                                     display,;
                                 Optional prefix to apply to the
                                     search string for scoped browses. }

                      The element descriptions are:

                      1 - The column number is simply the member of
                          aColumns which contains your index key.

                      2 - The current search string will be
                          highlighted within the highlight bar for the
                          browse. You may specify a colour or use the
                          default.

                      3 - The code block uses the current search
                          string as a parameter. Therefore it must be
                          of a form to properly locate keys in the
                          index. The default is to apply UPPER() to
                          the search string. You may make adjustments
                          for the method you used to create  your
                          index.

                      4 - A mask for the display to compensate for
                          differences in the index key and the
                          displayed values. For instance, if you store
                          phone numbers as:

                               4166285086 in the file.

                          Then you use:

                               TRANSFORM( cPhone, ;
                                          "@R (999) 999-9999" )

                          to display them. The mask would be:

                               "X   XX   X    "
                                (999) 999-9999

                          X's or any character can be used in
                          positions where displayed data is not the
                          actual information if the database.

                      5 - If you are operating a scoped browse, all
                          the displayed records have keys starting
                          with the same character sequence. You may
                          pass this sequence to the search mechanism
                          so the highlighting will match the display.
                          For instance, if you are indexed on phone
                          number and scope to all records in the 416
                          exchange, your search prefix would be:

                               "416"

                      If aSrch is not passed, the default search
                      mechanism is:

                          1 - Search on column 1 of the browse.
                          2 - Clipper unselected colour.
                          3 - {|c| UPPER( c ) }
                          4 - SPACE( LEN( &(INDEXKEY())))
                          5 - Empty string.

     lALite     - 'L' Logical to indicate whether or not to use field
                      pointing for the highlight or to disable it and
                      highlight an entire row of the display. If
                      lAlite is FALSE, the highlight bar search
                      mechanism is used. If lAlite is TRUE, the current
                      search string is displayed in the BOTTOM LEFT
                      WINDOW TITLE POSITION.

       Return:

     Current Record Number, or zero for exit without selection.

       Example:

     USE Phone INDEX Phone1, Phone2, Phone3 ALIAS Names NEW
     SET ORDER TO 3
     aSrch := { 3, "n/*gr",,, "X   XX   X    X    X" } // for phone search
     aColumns := {}
     cTitle := { "Dynamic Search on Third Field", "w+/bg", "B", "R" }
     SETBLINK( .F. )

     AADD( aColumns, TBCOLUMNNEW( 'Person;Name' , ;
                 {|| PADR( TRIM( FIELDGET( FIELDPOS( 'lname' ))) + ', ' +;
                         TRIM( FIELDGET( FIELDPOS( 'fname' ))) + ' ' +;
                         TRIM( FIELDGET( FIELDPOS( 'init'  ))), 19 );
                         },,,,,,,,{4,2},{||IF(DELETED(),{7,2},{4,2}) } ))
     AADD( aColumns, TBCOLUMNNEW( 'Company;Name', ;
                 {|| SUBSTR( FIELDGET( FIELDPOS( 'company' )), 1, 16 );
                          },,,,,,,,{1,2},{||IF(DELETED(),{7,2},{1,2}) } ))
     AADD( aColumns, TBCOLUMNNEW( 'Work;Phone', ;
               {|| TRANSFORM( Names->wphone, "@R (999) 999-9999(9999)" ) ;
                          },,,,,,,,{1,2},{||IF(DELETED(),{7,2},{1,2}) } ))
     AADD( aColumns, TBCOLUMNNEW( 'FAX;Phone', ;
               {|| TRANSFORM( Names->fphone , "@R (999) 999-9999(9999)" );
                          },,,,,,,,{1,2},{||IF(DELETED(),{7,2},{1,2}) } ))

     nChoice := twQDBrowse( wT, wL, wB, wR, aColumns, cTitle, ;
                    wColor, wSType, wFType, wFColor, nFreeze, aSrch, .F. )

See Also: twBRBrowse()

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