*  ===============================================================
*                 Sample Listbox BASIC Program
*
*                          LISTHOST
*
*  Demonstrates the use of the LISTBOX.SCR file using listbox
*  entries sent from the host system.
*
*
*           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
*
*   103                     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 @(-1)

*

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

*
*
* =================================================================
*  This section reads the DATA statements and sends the sample
*  employee names 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.
*
*  Note:  BBASIC requires that DATA strings be enclosed with quotes.
*   =================================================================
*

      DATA "Adams, Frank"
      DATA "Smith, David"
      DATA "Gates, Bill"
      DATA "Erickson, George"
      DATA "Banta, Fred"
      DATA "Baruch, Jay"
      DATA "Beck, Bob"
      DATA "Brown, Alex M"
      DATA "Clarkson, Robert"
      DATA "Conners, Richard V"
      DATA "Danenbarger, Sharron"
      DATA "Daniels, Paul"
      DATA "Darling, Scott F"
      DATA "Donchess, John"
      DATA "Dugan, Donald P"
      DATA "Smith, Steven"
      DATA "Harper, Lloyd"
      DATA "McGuire, Patrick"
      DATA "Sawyer, Tony"
      DATA "Donovan, Jay"
      DATA "EOF"

*  Get next string

      LOOP

*
*  Shut off any displays to the screen

         EXECUTE "PTERM ECHO OFF"

         INPUT STRING

         EXECUTE "PTERM ECHO ON"

*
*  Turn back on the displays to the screen

      UNTIL STRING = "EOF"

         PRINT @(1,1):
         PRINT QUOTE:STRING:QUOTE:
         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 employee name: ": ; INPUT STRING

      EXECUTE "PTERM CASE INVERT"  

*

   END
