home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / VOL8N11.ZIP / WINTEST.PRG < prev   
Text File  |  1989-02-20  |  5KB  |  139 lines

  1. * wintest.prg RHS 2/19/89
  2.  
  3. * This program demonstrates the new windowing and menuing abilities of 
  4. * dBASEIV. As a first task, the program creates a window, and prints a 
  5. * message. Then, it waits until the user presses a key. Upon receiving the
  6. * keystroke, the program moves the window from the upper left corner, to the
  7. * upper right corner, to the lower right corner, to the lower left corner,
  8. * and finally, back to the upper right corner.
  9. *
  10. * After removing the window, a horizontal menu, its pads, a popup menu for
  11. * for each pad, and their bars are defined. Since each popup menu is 
  12. * associated with a pad, each becomes a pulldown menu.
  13.  
  14. * You'll notice that the arrangement and titles of the menu pads and 
  15. * pulldowns are a deliberate copy of the Windows-type user interface.
  16.  
  17. * It should be easy to copy the ideas presented in this example program for
  18. * use in an application.
  19.  
  20. Set Talk off
  21. * First, define a Window....
  22. Define Window wtest from 1,5 to 7,25 double
  23.  
  24. * Then activate it
  25. Activate Window wtest
  26.  
  27. * Print a message in it
  28. @ 0,0 say "An example of dBASEIV windowing..."
  29. Wait
  30.  
  31. * Now move the window around the screen, first right...
  32. counter = 1
  33. Do While counter < 50
  34.     Move Window wtest by 0,1
  35.     counter = counter+1
  36. EndDo
  37.  
  38. * Then down...
  39. counter2 = 1
  40. Do While counter2 < 15
  41.     Move Window wtest by 1, 0
  42.     counter2 = counter2+1
  43. EndDo
  44.  
  45. * Then left...
  46. Do While counter > 0
  47.     Move Window wtest by 0,-1
  48.     counter = counter - 1
  49. EndDo
  50.  
  51. * And back up...
  52. Do While counter2 > 0
  53.     Move Window wtest by -1,0
  54.     counter2 = counter2-1
  55. EndDo
  56.  
  57. * now deactivate it and remove it from memory
  58. DeActivate Window wtest
  59. Clear Windows
  60.  
  61. * now define a horizontal menu
  62. Define Menu Main
  63. * and define the individual pads (selections) in it...
  64. Define Pad File of Main Prompt "File" At 0,4
  65. Define Pad Edit of Main Prompt "Edit" At 0,16
  66. Define Pad View of Main Prompt "View" At 0,30
  67. Define Pad Search of Main Prompt "Search" At 0,38
  68.  
  69. * now associate popup menus with each pad to make pulldown menus
  70. On Pad File Of Main Activate Popup File_pop
  71. On Pad Edit of Main Activate Popup Edit_pop
  72. On Pad View of Main Activate Popup View_pop
  73. On Pad Search of Main Activate Popup Search_pop
  74.  
  75. * now define each popup menu...
  76.  
  77. * define the first popup
  78. Define Popup File_pop from 1,4 Message "File Operations"
  79. * define its menu bars
  80. Define Bar 1 of File_pop Prompt "New"
  81. Define Bar 2 of File_pop Prompt "Open..."
  82. Define Bar 3 of File_pop Prompt "Open Last File"
  83. Define Bar 4 of File_pop Prompt "Merge"
  84. Define Bar 5 of File_pop Prompt "Save"
  85. Define Bar 6 of File_pop Prompt "Save As..."
  86. * Leave a blank bar on line 11 of the popup
  87. Define Bar 8 of File_pop Prompt "Set Program List..."
  88. Define Bar 9 of File_pop Prompt "Clear Program List..."
  89. Define Bar 10 of File_pop Prompt "Edit Program List..."
  90. * Leave a blank bar on line 11 of the popup
  91. Define Bar 12 of File_pop Prompt "Print..."
  92. Define Bar 13 of File_pop Prompt "DOS Shell"
  93.  
  94. * define the next popup
  95. Define Popup Edit_pop from 1,16 Message "Editing Facilities"
  96. * define its menu bars
  97. Define Bar 1 of Edit_pop Prompt "Undo"
  98. Define Bar 2 of Edit_pop Prompt "Cut"
  99. Define Bar 3 of Edit_pop Prompt "Paste"
  100. Define Bar 4 of Edit_pop Prompt "Clear"
  101. *      Bar 6 remains blank
  102. Define Bar 6 of Edit_pop Prompt "Read Only"
  103.  
  104. * define another popup
  105. Define Popup View_pop from 1,30 Message "Views Available"
  106. * define its menu bars
  107. Define Bar 1 of View_pop Prompt "Source"
  108. Define Bar 2 of View_pop Prompt "Include"
  109. *      Bar 3 remains blank
  110. Define Bar 4 of View_pop Prompt "Options..."
  111. Define Bar 5 of View_pop Prompt "Output Screen"
  112. *      Bar 6 remains blank
  113. Define Bar 7 of View_pop Prompt "Errors"
  114.  
  115. * define the last popup
  116. Define Popup Search_pop from 1,38 Message "Search Options"
  117. * define its menu bars
  118. Define Bar 1 of Search_pop Prompt "Find..."
  119. Define Bar 2 of Search_pop Prompt "Selected Text"
  120. Define Bar 3 of Search_pop Prompt "Repeat Last Find"
  121. Define Bar 4 of Search_pop Prompt "Change"
  122. Define Bar 5 of Search_pop Prompt "Function"
  123.  
  124. * Now set up a procedure to be executed if the File_pop popup is activated
  125. On Selection Popup File_pop Do OpenFile
  126.  
  127. * activate the horizontal menu
  128. Activate Menu Main
  129. Return
  130.  
  131. Procedure OpenFile        && can process menu selections for File_pop
  132.     Do Case
  133.     Case Bar() = 2        && for "Open..."
  134.         Define Popup files From 4,5 To 20,35 Prompt Files Like *.dbf
  135.         Activate Popup Files
  136.     Endcase
  137.     Return
  138.  
  139.