home *** CD-ROM | disk | FTP | other *** search
/ Windows Shareware GOLD / NuclearComputingVol3No1.cdr / other / f1238 / mboxmac.txt < prev    next >
Text File  |  1990-10-28  |  3KB  |  74 lines

  1. 'MessageBox
  2. 'by Jonathan Zuck
  3. 'User Friendly, Inc.
  4. 'This macro assists the WinWord BASIC programmer in the 
  5. 'construction of the "MsgBox" syntax.  After simple selections
  6. 'are made from a dialog box, the "MsgBox" statement is 
  7. 'constructed, along with a "select Case" construct to handle
  8. 'the return codes from the function.
  9. 'To use this macro, select "Edit" from the Macro menu,
  10. 'type "MessageBox" as the name of the macro, make sure that
  11. '"global is selected and click OK.  Then copy and paste the text
  12. 'below beginning with "Begin Dialog...." into the macro and save.
  13. 'You may then wish to associate the macro with a button for easier
  14. 'use.  Hope this is as usefull to you as it is to me! -=- JZ
  15.  
  16. Sub MAIN 
  17. Begin Dialog UserDialog 400, 250 
  18.     Text 120, 8, 250, 10, "Message Box Definition" 
  19.     OKButton 120, 220, 64, 18 
  20.     CancelButton 220, 220, 64, 18 
  21.     GroupBox 30, 25, 150, 110, "Buttons" 
  22.     OptionGroup .Buttons 
  23.         OptionButton 35, 35, 70, 18, "Ok" 
  24.         OptionButton 35, 50, 150, 18, "Ok/Cancel" 
  25.         OptionButton 35, 65, 150, 18, "Abort/Retry/Ignore" 
  26.         OptionButton 35, 80, 150, 18, "Yes/No/Cancel" 
  27.         OptionButton 35, 95, 150, 18, "Yes/No" 
  28.         OptionButton 35, 110, 150, 18, "Retry/Cancel" 
  29.     GroupBox 210, 25, 150, 95, "Icon" 
  30.     OptionGroup .Icon 
  31.         OptionButton 225, 35, 70, 18, "None" 
  32.         OptionButton 225, 50, 150, 18, "Hand" 
  33.         OptionButton 225, 65, 150, 18, "Question" 
  34.         OptionButton 225, 80, 150, 18, "Exclamation" 
  35.         OptionButton 225, 95, 150, 18, "Asterisk" 
  36.     Text 30, 140, 150, 10, "&Title" 
  37.     TextBox  30, 155, 340, 15,  .Title 
  38.     Text 30, 175, 150, 10, "&Message" 
  39.     TextBox  30, 190, 340, 15, .Msg 
  40. End Dialog 
  41. Dim MType As Dialog UserDialog 
  42. Dialog MType 
  43. Quote$ = Chr$(34) 
  44. CR$ = Chr$(13) 
  45. Insert "MTitle$ = " + Quote$ + MType.Title + Quote$ + CR$ 
  46. Insert "MMsg$ = " + Quote$ + MType.Msg + Quote$ + CR$ 
  47. Insert "MType = " + Str$(MType.Buttons +(MType.Icon * 16)) + CR$ 
  48. Insert "Button = MsgBox (MMsg$, MTitle$, MType) " + CR$ 
  49. If MType.Buttons > 0 Then 
  50.     Tab$ = Chr$(9) 
  51.     Insert "Select Case Button" + CR$ 
  52.     Select Case MType.Buttons 
  53.         Case 1 
  54.             Insert Tab$ + "Case -1              'pressed OK" + CR$ + CR$ 
  55.             Insert Tab$ + "Case 0                'pressed Cancel" +  CR$ 
  56.         Case 2 
  57.             Insert Tab$ + "Case -1               'pressed Abort" + CR$ + CR$ 
  58.             Insert Tab$ + "Case 0                 'pressed Retry" + CR$ + CR$ 
  59.             Insert Tab$ + "Case 1                 'pressed Ignore" + CR$ 
  60.         Case 3, 4 
  61.             Insert Tab$ + "Case -1               'pressed Yes" + CR$ + CR$ 
  62.             Insert Tab$ + "Case 0                 'pressed No" + CR$ 
  63.             If MType.Buttons = 3 Then   
  64.                 Insert CR$ 
  65.                 Insert Tab$ + "Case 1                 'pressed Cancel" + CR$ 
  66.             End If 
  67.         Case 5 
  68.             Insert Tab$ + "Case -1               'pressed Retry" + CR$ + CR$ 
  69.             Insert Tab$ + "Case 0                 'pressed Cancel" + CR$ 
  70.     End Select 
  71.     Insert "end select" + CR$ 
  72. End If 
  73. End Sub 
  74.