home *** CD-ROM | disk | FTP | other *** search
- Type APIMsgBoxMasterForm From SampleMasterForm
- Dim btnShow As New Button
- Dim Label1 As New Label
- Dim Label2 As New Label
- Dim txtTitle As New TextBox
- Dim txtMessage As New TextBox
- Dim Label3 As New Label
- Dim Label4 As New Label
- Dim Label5 As New Label
- Dim lblClickResult As New Label
- Dim Label6 As New Label
- Dim Label7 As New Label
- Dim Label8 As New Label
- Dim Label9 As New Label
- Dim Label10 As New Label
- Dim Label11 As New Label
- Dim Label12 As New Label
- Dim Label13 As New Label
- Dim cboButtonStyle As New ComboBox
- Dim cboIconStyle As New ComboBox
-
- ' METHODS for object: APIMsgBoxMasterForm
- Sub btnShow_Click()
- dim title As String
- dim message As String
- dim theObject As Object
-
- title = txtTitle.Text
- message = txtMessage.Text
-
- ' Determine which message box to display
- Select Case cboButtonStyle.Text
- Case "Abort, Retry, Ignore"
- theObject = AbortRetryIgnoreBox
- Case "OK"
- theObject = InfoBox
- Case "OK, Cancel"
- theObject = OKCancelBox
- Case "Retry, Cancel"
- theObject = RetryCancelBox
- Case "Yes, No"
- theObject = YesNoBox
- Case "Yes, No, Cancel"
- theObject = YesNoCancelBox
- End Select
-
- ' Determine which icon should be present
- Select Case cboIconStyle.Text
- Case "None"
- theObject.SetIconNone()
- Case "Stop"
- theObject.SetIconStop()
- Case "Question"
- theObject.SetIconQuestion()
- Case "Exclamation"
- theObject.SetIconExclamation()
- Case "Information"
- theObject.SetIconInfo()
- End Select
- theObject.Message(title, message)
- lblClickResult.Caption = theObject.result
-
-
- End Sub
-
- Sub cboButtonStyle_Setup()
- cboButtonStyle.Clear
- cboButtonStyle.AddItem("Abort, Retry, Ignore")
- cboButtonStyle.AddItem("OK")
- cboButtonStyle.AddItem("OK, Cancel")
- cboButtonStyle.AddItem("Retry, Cancel")
- cboButtonStyle.AddItem("Yes, No")
- cboButtonStyle.AddItem("Yes, No, Cancel")
- cboButtonStyle.ListIndex = 1
- End Sub
-
- Sub cboIconStyle_Setup()
- cboIconStyle.Clear
- cboIconStyle.AddItem("None")
- cboIconStyle.AddItem("Stop")
- cboIconStyle.AddItem("Question")
- cboIconStyle.AddItem("Exclamation")
- cboIconStyle.AddItem("Information")
- cboIconStyle.ListIndex = 0
- End Sub
-
- Sub ResetApplication_Click ()
-
- ' Initialize the MessageBox Demonstration
-
- ' Clear the textboxes
- txtTitle.Text = ""
- txtMessage.Text = ""
-
- ' Reset the combo boxes
- cboButtonStyle.ListIndex = 1
- cboIconStyle.ListIndex = 0
-
-
- ' Reset the click result label
- lblClickResult.Caption = ""
-
- txtTitle.SetFocus
-
- End Sub
-
- End Type
-
- Begin Code
- ' Reconstruction commands for object: APIMsgBoxMasterForm
- '
- With APIMsgBoxMasterForm
- .Caption := "Windows Message Box Demonstration"
- .Move(1560, 1395, 6840, 5040)
- .SampleDir := "W:\Examples\apimsgbx\"
- .SampleName := "apimsgbx"
- With .btnShow
- .Caption := "Show"
- .Move(4500, 3300, 1050, 450)
- End With 'APIMsgBoxMasterForm.btnShow
- With .Label1
- .Caption := "1. Enter Title"
- .ForeColor := 13107200
- .Move(300, 300, 1650, 300)
- End With 'APIMsgBoxMasterForm.Label1
- With .Label2
- .Caption := "2. Enter Message"
- .ForeColor := 13107200
- .Move(300, 750, 1800, 300)
- End With 'APIMsgBoxMasterForm.Label2
- With .txtTitle
- .Move(2250, 300, 4200, 360)
- End With 'APIMsgBoxMasterForm.txtTitle
- With .txtMessage
- .Move(2250, 750, 4200, 360)
- End With 'APIMsgBoxMasterForm.txtMessage
- With .Label3
- .Caption := "3. Choose button style."
- .ForeColor := 13107200
- .Move(300, 1350, 2400, 300)
- End With 'APIMsgBoxMasterForm.Label3
- With .Label4
- .Caption := "4. Choose Icon style."
- .ForeColor := 13107200
- .Move(3900, 1350, 2250, 300)
- End With 'APIMsgBoxMasterForm.Label4
- With .Label5
- .Caption := "Button clicked"
- .ForeColor := 13107200
- .Move(300, 2550, 1500, 300)
- End With 'APIMsgBoxMasterForm.Label5
- With .lblClickResult
- .Caption := "3"
- .Move(1950, 2550, 450, 300)
- .BorderStyle := "Fixed Single"
- .Alignment := "Center"
- End With 'APIMsgBoxMasterForm.lblClickResult
- With .Label6
- .Caption := "1 = OK"
- .Move(300, 3000, 750, 300)
- End With 'APIMsgBoxMasterForm.Label6
- With .Label7
- .Caption := "2 = Cancel"
- .Move(300, 3300, 1050, 300)
- End With 'APIMsgBoxMasterForm.Label7
- With .Label8
- .Caption := "3 = Abort"
- .Move(300, 3600, 1050, 300)
- End With 'APIMsgBoxMasterForm.Label8
- With .Label9
- .Caption := "4 = Retry"
- .Move(300, 3900, 1050, 300)
- End With 'APIMsgBoxMasterForm.Label9
- With .Label10
- .Caption := "5 = Ignore"
- .Move(1650, 3000, 1050, 300)
- End With 'APIMsgBoxMasterForm.Label10
- With .Label11
- .Caption := "6 = Yes"
- .Move(1650, 3300, 900, 300)
- End With 'APIMsgBoxMasterForm.Label11
- With .Label12
- .Caption := "7 = No"
- .Move(1650, 3600, 900, 300)
- End With 'APIMsgBoxMasterForm.Label12
- With .Label13
- .Caption := "5. Click Show button."
- .ForeColor := 13107200
- .Move(3900, 2700, 2250, 300)
- End With 'APIMsgBoxMasterForm.Label13
- With .cboButtonStyle
- .Move(300, 1800, 2700, 360)
- .Style := "DropdownList"
- End With 'APIMsgBoxMasterForm.cboButtonStyle
- With .cboIconStyle
- .Move(3900, 1800, 2700, 360)
- .Sorted := False
- .Style := "DropdownList"
- End With 'APIMsgBoxMasterForm.cboIconStyle
- With .helpfile
- .FileName := "C:\ENVELOP\PROGRAM\apimsgbx.hlp"
- End With 'APIMsgBoxMasterForm.helpfile
- End With 'APIMsgBoxMasterForm
- End Code
-