*  ===============================================================
*                 Sample Listbox BASIC Program
*
*                          LISTHDAT
*
*  Demonstrates the use of the LISTBOX.SCR file using listbox
*  entries sent from the host system.  The listbox contains
*  hidden data fields.
*
*           Copyright CLEARVIEW Software Inc. 1992, 1993
*                      All Rights Reserved
*  ===============================================================
*
*
* =================================================================
*  Dimension some string variables and assign the API string prefix
* =================================================================

      EQU MAGIC TO CHAR(127)
      EQU QUOTE TO CHAR(34)


*
*
* =================================================================
*  Send the API to Co*Star using the following output:
*
*   Output                  Description
*   ---------------------   ---------------------------------------
*   MAGIC:"UWSCRIPT        API for executing external script file
*
*   sdk\listbox.scr         Path and filename for the script file
*
*   104                     List box type -- information is sent
*                           from the host as screen output.
*                           The listbox is automatically sorted.
*                           See LISTBOX.SCR for details.
*
*  Sample Listbox           Title for the listbox window.
*
*  1                        Flag to append a CR to the selected
*                           item.
*
*  10,30,20,50              Display coordinates for listbox.
*
*  MAGIC                   API terminator.
* =================================================================
*


      PRINT MAGIC:"UWSCRIPTsdk\listbox.scr,104,Sample ListBox,1":
      PRINT ",10,30,20,50":MAGIC:


*
*
* =================================================================
*  This section reads the DATA statements and sends the sample
*  employee names and IDs to Co*Star.  Since the employee names contain
*  a comma (ex. Adams, Frank) the name must be enclosed with
*  quotes.   Commas are used to delineate entries in the listbox.
*
*  The PRINT@(1,1) statement is used to move the cursor to row 1,
*  column 1.  This is to prevent the host system from scrolling the
*  screen as a result of all the print statements.
*
*  Once the list is completed the MAGIC character is sent to
*  signal Co*Star the listbox is ready to display.
* =================================================================
*
*
*  =================================================================
*  DATA Statements for the listbox.  The names could be read from a
*  file on the host system as well.  Note that the names are not
*  sorted in this list.
*
*  Each name is followed by a sample employee number.
*
*   =================================================================

      DATA "Adams, Frank",1000
      DATA "Smith, David",1001
      DATA "Gates, Bill",1002
      DATA "Erickson, George",1003
      DATA "Banta, Fred",1004
      DATA "Baruch, Jay",1005
      DATA "Beck, Bob",1006
      DATA "Brown, Alex M",1007
      DATA "Clarkson, Robert",1008
      DATA "Conners, Richard V",1009
      DATA "Danenbarger, Sharron",1010
      DATA "Daniels, Paul",1011
      DATA "Darling, Scott F",1012
      DATA "Donchess, John",1013
      DATA "Dugan, Donald P",1014
      DATA "Smith, Steven",1015
      DATA "Harper, Lloyd",1016
      DATA "McGuire, Patrick",1017
      DATA "Sawyer, Tony",1018
      DATA "Donovan, Jay",1019
      DATA "EOF",-1

*
*  Get next string and employee ID

      LOOP

*
*  Turn off any displays to the screen

         EXECUTE "PTERM ECHO OFF"

         INPUT STRING ; INPUT ID

         EXECUTE "PTERM ECHO ON"

*
*   Turn back on the displays to the screen

      UNTIL STRING = "EOF"

         PRINT @(1,1):
         PRINT QUOTE:STRING:QUOTE:
         PRINT ",":
         PRINT ID
         PRINT ",":

      REPEAT


*
*
* Now, end the listbox

      PRINT MAGIC:

*
*
* =================================================================
*  Wait for the user to  select an item from the list box.
*  The selected data item will be returned to STRING.  If no
*  selection was made then STRING will be null.
* =================================================================

   EXECUTE "PTERM CASE NOINVERT"  

   PRINT @(-1)
   PRINT "Enter ID: ":
   INPUT STRING

   EXECUTE "PTERM CASE INVERT"  

*

   END
