home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 24 / CD_ASCQ_24_0995.iso / dos / tools / aurora21 / dlgdemo.aml < prev    next >
Text File  |  1995-08-10  |  3KB  |  114 lines

  1. /* ------------------------------------------------------------------ */
  2. /* Macro:        DLGDEMO.AML                                          */
  3. /* Written by:   nuText Systems                                       */
  4. /*                                                                    */
  5. /* Description:  This macro demonstrates how to create a dialog box   */
  6. /*               with various controls.                               */
  7. /*                                                                    */
  8. /* Usage:        Select this macro from the Macro List (on the Macro  */
  9. /*               menu), or run it from the macro picklist <shift f12> */
  10. /* ------------------------------------------------------------------ */
  11.  
  12.   include bootpath "define.aml"
  13.  
  14.   var control1
  15.   var control2
  16.   var control3
  17.   var control4
  18.   var control5
  19.  
  20.   // main dialog box
  21.   dialog "Dialog Box Demo" 69 15 "c"
  22.  
  23.   // write background text on the dialog box
  24.   gotoxy 52 13
  25.   writestr "Back"
  26.   writestr "ground"     (color magenta on gray)
  27.   writestr " Text"      (color brightred on gray)
  28.   gotoxy 53 14
  29.   writestr "of"         (color yellow on gray)
  30.   writestr " any"       (color brightgreen on gray)
  31.   writestr " color"     (color brightblue on gray)
  32.  
  33.   // control #1: listbox
  34.   filespec = getbootpath + "\\MACRO\\*.AML"
  35.   listbox "&Listbox:" 3 2 (loadbuf filespec) 16 12
  36.   whenenter "listenter"
  37.   function listenter
  38.     msgbox "You selected:  " + (sub ' ' '' gettext [1 : 14])
  39.   end
  40.  
  41.   // control #2: edit field
  42.   field "&Edit Field 1: >"  21  3 14 "string"
  43.  
  44.   // control #3: edit field
  45.   field "Edit &Field 2:"    21  5 28 "FILE.TXT" "_load"
  46.  
  47.   // control #4: check boxes
  48.   groupbox 'Check Boxes:' 52 2
  49.     (menu ''
  50.        item " [ ] &Apples"
  51.        item " [ ] &Oranges"
  52.        item " [ ] &Melons"
  53.        item " [ ] &Bananas"
  54.      end) 15 'am' 'aomb'
  55.   whenselect "checkbox"
  56.   function checkbox
  57.     beep (if? (getchar 3) == 'X' 430 107) 90
  58.   end
  59.  
  60.   // control #5: radio buttons
  61.   groupbox 'Radio Buttons: ' 52 8
  62.     (menu ''
  63.        item " ( ) &Yes"
  64.        item " ( ) &No"
  65.        item " ( ) &Maybe"
  66.      end) '' 'y' 'yno'
  67.   whenselect "radio"
  68.   function radio
  69.     line = getrow
  70.     if line == 3 then
  71.       beep 430 45
  72.       beep 107 45
  73.     else
  74.       beep (if? line == 1 430 107) 90
  75.     end
  76.   end
  77.  
  78.   // controls #6,#7: ok/cancel buttons
  79.   button "O&k"    23  9 8
  80.   button "Cancel" 23 11 8
  81.  
  82.   // control #8: long button
  83.   button "Long &Button" 21 14 28
  84.   whenenter "longbutton"
  85.   function longbutton
  86.     beep 215 100
  87.   end
  88.  
  89.   // control #9: fat button
  90.   button "" 35 8 14 5
  91.   writestr "Fat Button" (color black on green) 3 3
  92.   whenenter "fatbutton"
  93.   function fatbutton
  94.     beep  60 70
  95.   end
  96.  
  97.   // display the dialog box, passing return variables by-reference
  98.   if (getdialog ref control1 ref control2 ref control3
  99.                 ref control4 ref control5) == 'Ok' then
  100.  
  101.     // create another dialog box to display the
  102.     // return values from getdialog
  103.     dialog "Dialog Box Return Values" 40 9 "c"
  104.     writeline
  105.     writeline " Listbox:       "  + control1 [1 : 15]
  106.     writeline " Edit Field 1:   " + control2
  107.     writeline " Edit Field 2:   " + control3
  108.     writeline " Check Boxes:    " + control4
  109.     writeline " Radio Buttons:  " + control5
  110.     button "O&k" 17  8 8
  111.     getdialog
  112.  
  113.   end
  114.