home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Database / CLIPR503.W96 / LISTBOX.PR_ / LISTBOX.PR
Text File  |  1995-06-20  |  2KB  |  105 lines

  1. /***
  2. *
  3. *  LISTBOX.PRG
  4. *
  5. *  Sample listbox program
  6. *
  7. *  Copyright (c) 1990-1995, Computer Associates International Inc.
  8. *  All rights reserved.
  9. *
  10. *  NOTE: Compile with /n
  11. *
  12. */
  13.  
  14. // Manifest Constant Definitions
  15. #DEFINE S_ADD     "Add"
  16. #DEFINE S_EDIT    "Edit"
  17. #DEFINE S_REPORT  "Report"
  18. #DEFINE S_QUIT    "Quit"
  19.  
  20. // Filewide variable declarations go here; we have none
  21.  
  22. PROCEDURE Main
  23. // Local variable declarations
  24. LOCAL cChoice
  25.  
  26. // Continuous loop redisplays listbox after each
  27. // function return
  28. DO WHILE .T.
  29.  
  30.   // Function call to create the listbox
  31.   cChoice := CreateListbox()
  32.  
  33.   // Clear the screen
  34.   CLEAR
  35.  
  36.   // CASE structure to make function call based
  37.   // on return value of CreateListbox()
  38.   DO CASE
  39.  
  40.     // Functions below do not do much, but are
  41.     // placed at the bottom of this file for
  42.     // completeness
  43.     CASE cChoice = S_ADD
  44.       AddRecs()
  45.  
  46.     CASE cChoice = S_EDIT
  47.       EditRecs()
  48.  
  49.     CASE cChoice = S_REPORT
  50.       Reports()
  51.  
  52.     // If cChoice does not match any of the above
  53.     // (S_QUIT was chosen), then we should EXIT
  54.     OTHERWISE
  55.       EXIT
  56.  
  57.   ENDCASE
  58.  
  59. ENDDO
  60.  
  61. RETURN
  62.  
  63.  
  64. FUNCTION CreateListbox()
  65.  
  66. // Local variable declarations
  67.  
  68. // Array of choices
  69. LOCAL aChoices := { S_ADD, S_EDIT, S_REPORT, S_QUIT }
  70. // Set the default value to S_ADD
  71. LOCAL cListChoice := S_ADD
  72.  
  73. // Clear the screen
  74. CLEAR
  75.  
  76. // Create the listbox with our four choices
  77. @ 1,31,6,45 GET cListChoice LISTBOX aChoices
  78.  
  79. // Get the user's input
  80. READ
  81.  
  82. // Return the choice
  83. RETURN(cListChoice)
  84.  
  85.  
  86. FUNCTION AddRecs()
  87. // Add records routine goes here
  88. @ 1,1 SAY "Adding records..."
  89. WAIT
  90. RETURN NIL
  91.  
  92.  
  93. FUNCTION EditRecs()
  94. // Edit records routine goes here
  95. @ 1,1 SAY "Editing records..."
  96. WAIT
  97. RETURN NIL
  98.  
  99.  
  100. FUNCTION Reports()
  101. // Reports routine goes here
  102. @ 1,1 SAY "Running reports..."
  103. WAIT
  104. RETURN NIL
  105.