home *** CD-ROM | disk | FTP | other *** search
/ The Best of Select: Windows 95 Special 2 / WIN95_2.bin / utils / envelop / envelop.6 / Tools / Bootcamp / basic / apimsgbx / apimsgbx.eto < prev    next >
Encoding:
Text File  |  1996-07-08  |  5.8 KB  |  205 lines

  1. Type APIMsgBoxMasterForm From SampleMasterForm
  2.   Dim btnShow As New Button
  3.   Dim Label1 As New Label
  4.   Dim Label2 As New Label
  5.   Dim txtTitle As New TextBox
  6.   Dim txtMessage As New TextBox
  7.   Dim Label3 As New Label
  8.   Dim Label4 As New Label
  9.   Dim Label5 As New Label
  10.   Dim lblClickResult As New Label
  11.   Dim Label6 As New Label
  12.   Dim Label7 As New Label
  13.   Dim Label8 As New Label
  14.   Dim Label9 As New Label
  15.   Dim Label10 As New Label
  16.   Dim Label11 As New Label
  17.   Dim Label12 As New Label
  18.   Dim Label13 As New Label
  19.   Dim cboButtonStyle As New ComboBox
  20.   Dim cboIconStyle As New ComboBox
  21.  
  22.   ' METHODS for object: APIMsgBoxMasterForm
  23.   Sub btnShow_Click()
  24.     dim title As String
  25.     dim message As String
  26.     dim theObject As Object
  27.   
  28.     title = txtTitle.Text
  29.     message = txtMessage.Text
  30.   
  31.     ' Determine which message box to display
  32.     Select Case cboButtonStyle.Text
  33.       Case "Abort, Retry, Ignore"
  34.         theObject = AbortRetryIgnoreBox
  35.       Case "OK"
  36.         theObject = InfoBox
  37.       Case "OK, Cancel"
  38.         theObject = OKCancelBox
  39.       Case "Retry, Cancel"
  40.         theObject = RetryCancelBox
  41.       Case "Yes, No"
  42.         theObject = YesNoBox
  43.       Case "Yes, No, Cancel"
  44.         theObject = YesNoCancelBox
  45.     End Select
  46.   
  47.     ' Determine which icon should be present
  48.     Select Case cboIconStyle.Text
  49.       Case "None"
  50.         theObject.SetIconNone()
  51.       Case "Stop"
  52.         theObject.SetIconStop()
  53.       Case "Question"
  54.         theObject.SetIconQuestion()
  55.       Case "Exclamation"
  56.         theObject.SetIconExclamation()
  57.       Case "Information"
  58.         theObject.SetIconInfo()
  59.     End Select
  60.     theObject.Message(title, message)
  61.     lblClickResult.Caption = theObject.result
  62.   
  63.   
  64.   End Sub
  65.  
  66.   Sub cboButtonStyle_Setup()
  67.     cboButtonStyle.Clear
  68.     cboButtonStyle.AddItem("Abort, Retry, Ignore")
  69.     cboButtonStyle.AddItem("OK")
  70.     cboButtonStyle.AddItem("OK, Cancel")
  71.     cboButtonStyle.AddItem("Retry, Cancel")
  72.     cboButtonStyle.AddItem("Yes, No")
  73.     cboButtonStyle.AddItem("Yes, No, Cancel")
  74.     cboButtonStyle.ListIndex = 1
  75.   End Sub
  76.  
  77.   Sub cboIconStyle_Setup()
  78.     cboIconStyle.Clear
  79.     cboIconStyle.AddItem("None")
  80.     cboIconStyle.AddItem("Stop")
  81.     cboIconStyle.AddItem("Question")
  82.     cboIconStyle.AddItem("Exclamation")
  83.     cboIconStyle.AddItem("Information")
  84.     cboIconStyle.ListIndex = 0
  85.   End Sub
  86.  
  87.   Sub ResetApplication_Click ()
  88.   
  89.     ' Initialize the MessageBox Demonstration
  90.   
  91.     ' Clear the textboxes
  92.     txtTitle.Text = ""
  93.     txtMessage.Text = ""
  94.   
  95.     ' Reset the combo boxes
  96.     cboButtonStyle.ListIndex = 1
  97.     cboIconStyle.ListIndex = 0
  98.   
  99.   
  100.     ' Reset the click result label
  101.     lblClickResult.Caption = ""
  102.   
  103.     txtTitle.SetFocus
  104.   
  105.   End Sub
  106.  
  107. End Type
  108.  
  109. Begin Code
  110. ' Reconstruction commands for object: APIMsgBoxMasterForm
  111. '
  112.   With APIMsgBoxMasterForm
  113.     .Caption := "Windows Message Box Demonstration"
  114.     .Move(1560, 1395, 6840, 5040)
  115.     .SampleDir := "W:\Examples\apimsgbx\"
  116.     .SampleName := "apimsgbx"
  117.     With .btnShow
  118.       .Caption := "Show"
  119.       .Move(4500, 3300, 1050, 450)
  120.     End With  'APIMsgBoxMasterForm.btnShow
  121.     With .Label1
  122.       .Caption := "1. Enter Title"
  123.       .ForeColor := 13107200
  124.       .Move(300, 300, 1650, 300)
  125.     End With  'APIMsgBoxMasterForm.Label1
  126.     With .Label2
  127.       .Caption := "2. Enter Message"
  128.       .ForeColor := 13107200
  129.       .Move(300, 750, 1800, 300)
  130.     End With  'APIMsgBoxMasterForm.Label2
  131.     With .txtTitle
  132.       .Move(2250, 300, 4200, 360)
  133.     End With  'APIMsgBoxMasterForm.txtTitle
  134.     With .txtMessage
  135.       .Move(2250, 750, 4200, 360)
  136.     End With  'APIMsgBoxMasterForm.txtMessage
  137.     With .Label3
  138.       .Caption := "3. Choose button style."
  139.       .ForeColor := 13107200
  140.       .Move(300, 1350, 2400, 300)
  141.     End With  'APIMsgBoxMasterForm.Label3
  142.     With .Label4
  143.       .Caption := "4. Choose Icon style."
  144.       .ForeColor := 13107200
  145.       .Move(3900, 1350, 2250, 300)
  146.     End With  'APIMsgBoxMasterForm.Label4
  147.     With .Label5
  148.       .Caption := "Button clicked"
  149.       .ForeColor := 13107200
  150.       .Move(300, 2550, 1500, 300)
  151.     End With  'APIMsgBoxMasterForm.Label5
  152.     With .lblClickResult
  153.       .Caption := "3"
  154.       .Move(1950, 2550, 450, 300)
  155.       .BorderStyle := "Fixed Single"
  156.       .Alignment := "Center"
  157.     End With  'APIMsgBoxMasterForm.lblClickResult
  158.     With .Label6
  159.       .Caption := "1 = OK"
  160.       .Move(300, 3000, 750, 300)
  161.     End With  'APIMsgBoxMasterForm.Label6
  162.     With .Label7
  163.       .Caption := "2 = Cancel"
  164.       .Move(300, 3300, 1050, 300)
  165.     End With  'APIMsgBoxMasterForm.Label7
  166.     With .Label8
  167.       .Caption := "3 = Abort"
  168.       .Move(300, 3600, 1050, 300)
  169.     End With  'APIMsgBoxMasterForm.Label8
  170.     With .Label9
  171.       .Caption := "4 = Retry"
  172.       .Move(300, 3900, 1050, 300)
  173.     End With  'APIMsgBoxMasterForm.Label9
  174.     With .Label10
  175.       .Caption := "5 = Ignore"
  176.       .Move(1650, 3000, 1050, 300)
  177.     End With  'APIMsgBoxMasterForm.Label10
  178.     With .Label11
  179.       .Caption := "6 = Yes"
  180.       .Move(1650, 3300, 900, 300)
  181.     End With  'APIMsgBoxMasterForm.Label11
  182.     With .Label12
  183.       .Caption := "7 = No"
  184.       .Move(1650, 3600, 900, 300)
  185.     End With  'APIMsgBoxMasterForm.Label12
  186.     With .Label13
  187.       .Caption := "5. Click Show button."
  188.       .ForeColor := 13107200
  189.       .Move(3900, 2700, 2250, 300)
  190.     End With  'APIMsgBoxMasterForm.Label13
  191.     With .cboButtonStyle
  192.       .Move(300, 1800, 2700, 360)
  193.       .Style := "DropdownList"
  194.     End With  'APIMsgBoxMasterForm.cboButtonStyle
  195.     With .cboIconStyle
  196.       .Move(3900, 1800, 2700, 360)
  197.       .Sorted := False
  198.       .Style := "DropdownList"
  199.     End With  'APIMsgBoxMasterForm.cboIconStyle
  200.     With .helpfile
  201.       .FileName := "C:\ENVELOP\PROGRAM\apimsgbx.hlp"
  202.     End With  'APIMsgBoxMasterForm.helpfile
  203.   End With  'APIMsgBoxMasterForm
  204. End Code
  205.