home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / message / msgbxcls / msgbxtst.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-01-06  |  23.3 KB  |  688 lines

  1. VERSION 4.00
  2. Begin VB.Form frmMsgBoxTest 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "MsgBox Class Test Project"
  5.    ClientHeight    =   6150
  6.    ClientLeft      =   1140
  7.    ClientTop       =   1560
  8.    ClientWidth     =   6765
  9.    Height          =   6585
  10.    Icon            =   "MSGBXTST.frx":0000
  11.    Left            =   1065
  12.    MaxButton       =   0   'False
  13.    ScaleHeight     =   410
  14.    ScaleMode       =   3  'Pixel
  15.    ScaleWidth      =   451
  16.    ShowInTaskbar   =   0   'False
  17.    Top             =   1200
  18.    Width           =   6915
  19.    Begin VB.TextBox txtObjectName 
  20.       Height          =   285
  21.       Left            =   5520
  22.       TabIndex        =   33
  23.       Text            =   "MB"
  24.       Top             =   3930
  25.       Width           =   1005
  26.    End
  27.    Begin VB.TextBox txtGeneratedCode 
  28.       Height          =   915
  29.       Left            =   270
  30.       MultiLine       =   -1  'True
  31.       ScrollBars      =   2  'Vertical
  32.       TabIndex        =   35
  33.       Top             =   4860
  34.       Width           =   6285
  35.    End
  36.    Begin VB.Frame fmeCallFormat 
  37.       Caption         =   "Call Format"
  38.       Height          =   885
  39.       Left            =   240
  40.       TabIndex        =   26
  41.       Top             =   3810
  42.       Width           =   2415
  43.       Begin VB.OptionButton optCallFormat 
  44.          Caption         =   "Set Properties First"
  45.          Height          =   225
  46.          Index           =   0
  47.          Left            =   240
  48.          TabIndex        =   27
  49.          Top             =   240
  50.          Value           =   -1  'True
  51.          Width           =   1950
  52.       End
  53.       Begin VB.OptionButton optCallFormat 
  54.          Caption         =   "Use Values In-line"
  55.          Height          =   225
  56.          Index           =   1
  57.          Left            =   240
  58.          TabIndex        =   28
  59.          Top             =   510
  60.          Width           =   1950
  61.       End
  62.    End
  63.    Begin VB.Frame fmeCallType 
  64.       Caption         =   "Call Type"
  65.       Height          =   885
  66.       Left            =   2880
  67.       TabIndex        =   29
  68.       Top             =   3810
  69.       Width           =   1725
  70.       Begin VB.OptionButton optCallType 
  71.          Caption         =   "Sub"
  72.          Height          =   255
  73.          Index           =   0
  74.          Left            =   240
  75.          TabIndex        =   30
  76.          Top             =   240
  77.          Value           =   -1  'True
  78.          Width           =   1155
  79.       End
  80.       Begin VB.OptionButton optCallType 
  81.          Caption         =   "Function"
  82.          Height          =   255
  83.          Index           =   1
  84.          Left            =   240
  85.          TabIndex        =   31
  86.          Top             =   510
  87.          Width           =   1155
  88.       End
  89.    End
  90.    Begin VB.CommandButton cmdGenerateCall 
  91.       Caption         =   "&Generate Call"
  92.       Height          =   360
  93.       Left            =   4890
  94.       TabIndex        =   34
  95.       Top             =   4350
  96.       Width           =   1665
  97.    End
  98.    Begin VB.Frame fmeIcon 
  99.       Caption         =   "Icon"
  100.       Height          =   2205
  101.       Left            =   4890
  102.       TabIndex        =   18
  103.       Top             =   1230
  104.       Width           =   1665
  105.       Begin VB.OptionButton optIcon 
  106.          Caption         =   "In&formation"
  107.          Height          =   225
  108.          Index           =   4
  109.          Left            =   240
  110.          TabIndex        =   23
  111.          Top             =   1500
  112.          Width           =   1275
  113.       End
  114.       Begin VB.OptionButton optIcon 
  115.          Caption         =   "E&xclamation"
  116.          Height          =   225
  117.          Index           =   3
  118.          Left            =   240
  119.          TabIndex        =   22
  120.          Top             =   1200
  121.          Width           =   1275
  122.       End
  123.       Begin VB.OptionButton optIcon 
  124.          Caption         =   "&Question"
  125.          Height          =   225
  126.          Index           =   2
  127.          Left            =   240
  128.          TabIndex        =   21
  129.          Top             =   900
  130.          Width           =   1275
  131.       End
  132.       Begin VB.OptionButton optIcon 
  133.          Caption         =   "Cr&itical"
  134.          Height          =   225
  135.          Index           =   1
  136.          Left            =   240
  137.          TabIndex        =   20
  138.          Top             =   600
  139.          Width           =   1275
  140.       End
  141.       Begin VB.OptionButton optIcon 
  142.          Caption         =   "Non&e"
  143.          Height          =   225
  144.          Index           =   0
  145.          Left            =   240
  146.          TabIndex        =   19
  147.          Top             =   300
  148.          Value           =   -1  'True
  149.          Width           =   1275
  150.       End
  151.    End
  152.    Begin VB.Frame fmeModality 
  153.       Caption         =   "Modality"
  154.       Height          =   885
  155.       Left            =   2880
  156.       TabIndex        =   15
  157.       Top             =   2550
  158.       Width           =   1725
  159.       Begin VB.OptionButton optModality 
  160.          Caption         =   "&System"
  161.          Height          =   255
  162.          Index           =   1
  163.          Left            =   240
  164.          TabIndex        =   17
  165.          Top             =   510
  166.          Width           =   1155
  167.       End
  168.       Begin VB.OptionButton optModality 
  169.          Caption         =   "&Application"
  170.          Height          =   255
  171.          Index           =   0
  172.          Left            =   240
  173.          TabIndex        =   16
  174.          Top             =   240
  175.          Value           =   -1  'True
  176.          Width           =   1155
  177.       End
  178.    End
  179.    Begin VB.Frame fmeDefaultButton 
  180.       Caption         =   "Default Button"
  181.       Height          =   1275
  182.       Left            =   2880
  183.       TabIndex        =   11
  184.       Top             =   1230
  185.       Width           =   1725
  186.       Begin VB.OptionButton optDefaultButton 
  187.          Caption         =   "Button &3"
  188.          Height          =   255
  189.          Index           =   2
  190.          Left            =   240
  191.          TabIndex        =   14
  192.          Top             =   900
  193.          Width           =   1215
  194.       End
  195.       Begin VB.OptionButton optDefaultButton 
  196.          Caption         =   "Button &2"
  197.          Height          =   255
  198.          Index           =   1
  199.          Left            =   240
  200.          TabIndex        =   13
  201.          Top             =   600
  202.          Width           =   1215
  203.       End
  204.       Begin VB.OptionButton optDefaultButton 
  205.          Caption         =   "Button &1"
  206.          Height          =   255
  207.          Index           =   0
  208.          Left            =   240
  209.          TabIndex        =   12
  210.          Top             =   300
  211.          Value           =   -1  'True
  212.          Width           =   1215
  213.       End
  214.    End
  215.    Begin VB.CommandButton cmdTestMsgBox 
  216.       Caption         =   "Test Message Box"
  217.       Height          =   360
  218.       Left            =   4890
  219.       TabIndex        =   24
  220.       Top             =   255
  221.       Width           =   1665
  222.    End
  223.    Begin VB.CommandButton cmdClose 
  224.       Caption         =   "Close"
  225.       Height          =   360
  226.       Left            =   4890
  227.       TabIndex        =   25
  228.       Top             =   705
  229.       Width           =   1665
  230.    End
  231.    Begin VB.Frame fmeButtons 
  232.       Caption         =   "Buttons"
  233.       Height          =   2205
  234.       Left            =   210
  235.       TabIndex        =   4
  236.       Top             =   1230
  237.       Width           =   2415
  238.       Begin VB.OptionButton optButtons 
  239.          Caption         =   "&Retry + Cancel"
  240.          Height          =   225
  241.          Index           =   5
  242.          Left            =   240
  243.          TabIndex        =   10
  244.          Top             =   1800
  245.          Width           =   1950
  246.       End
  247.       Begin VB.OptionButton optButtons 
  248.          Caption         =   "Yes + &No"
  249.          Height          =   225
  250.          Index           =   4
  251.          Left            =   240
  252.          TabIndex        =   9
  253.          Top             =   1500
  254.          Width           =   1950
  255.       End
  256.       Begin VB.OptionButton optButtons 
  257.          Caption         =   "&Yes + No + Cancel"
  258.          Height          =   225
  259.          Index           =   3
  260.          Left            =   240
  261.          TabIndex        =   8
  262.          Top             =   1200
  263.          Width           =   1950
  264.       End
  265.       Begin VB.OptionButton optButtons 
  266.          Caption         =   "A&bort + Retry +Ignore"
  267.          Height          =   225
  268.          Index           =   2
  269.          Left            =   240
  270.          TabIndex        =   7
  271.          Top             =   900
  272.          Width           =   1950
  273.       End
  274.       Begin VB.OptionButton optButtons 
  275.          Caption         =   "OK + &Cancel"
  276.          Height          =   225
  277.          Index           =   1
  278.          Left            =   240
  279.          TabIndex        =   6
  280.          Top             =   600
  281.          Width           =   1950
  282.       End
  283.       Begin VB.OptionButton optButtons 
  284.          Caption         =   "&OK only"
  285.          Height          =   225
  286.          Index           =   0
  287.          Left            =   240
  288.          TabIndex        =   5
  289.          Top             =   300
  290.          Value           =   -1  'True
  291.          Width           =   1950
  292.       End
  293.    End
  294.    Begin VB.TextBox txtTitle 
  295.       Height          =   285
  296.       Left            =   1320
  297.       TabIndex        =   1
  298.       Text            =   "Test Title"
  299.       Top             =   330
  300.       Width           =   1425
  301.    End
  302.    Begin VB.TextBox txtMessage 
  303.       Height          =   285
  304.       Left            =   1320
  305.       TabIndex        =   3
  306.       Text            =   "Test Message"
  307.       Top             =   750
  308.       Width           =   3285
  309.    End
  310.    Begin VB.Label lblObject 
  311.       BackStyle       =   0  'Transparent
  312.       Caption         =   "Object:"
  313.       Height          =   255
  314.       Left            =   4920
  315.       TabIndex        =   32
  316.       Top             =   3990
  317.       Width           =   495
  318.    End
  319.    Begin VB.Line linHorzSep 
  320.       BorderColor     =   &H00808080&
  321.       Index           =   1
  322.       X1              =   14
  323.       X2              =   436
  324.       Y1              =   246
  325.       Y2              =   246
  326.    End
  327.    Begin VB.Line linHorzSep 
  328.       BorderColor     =   &H00FFFFFF&
  329.       Index           =   0
  330.       X1              =   14
  331.       X2              =   436
  332.       Y1              =   244
  333.       Y2              =   244
  334.    End
  335.    Begin VB.Label lblStatusBar 
  336.       AutoSize        =   -1  'True
  337.       BackStyle       =   0  'Transparent
  338.       Caption         =   "Copyright 
  339.  1995-1996 Gregg Irwin.  All Rights Reserved."
  340.       BeginProperty Font 
  341.          name            =   "MS Sans Serif"
  342.          charset         =   1
  343.          weight          =   400
  344.          size            =   9.75
  345.          underline       =   0   'False
  346.          italic          =   0   'False
  347.          strikethrough   =   0   'False
  348.       EndProperty
  349.       Height          =   240
  350.       Left            =   240
  351.       TabIndex        =   36
  352.       Top             =   5850
  353.       Width           =   4980
  354.    End
  355.    Begin VB.Label lblTitle 
  356.       BackStyle       =   0  'Transparent
  357.       Caption         =   "&Title:"
  358.       Height          =   225
  359.       Left            =   270
  360.       TabIndex        =   0
  361.       Top             =   360
  362.       Width           =   885
  363.    End
  364.    Begin VB.Label lblMessage 
  365.       BackStyle       =   0  'Transparent
  366.       Caption         =   "&Message:"
  367.       Height          =   225
  368.       Left            =   270
  369.       TabIndex        =   2
  370.       Top             =   780
  371.       Width           =   885
  372.    End
  373. Attribute VB_Name = "frmMsgBoxTest"
  374. Attribute VB_Creatable = False
  375. Attribute VB_Exposed = False
  376. ' MsgBox Class Test Project
  377. ' Copyright 
  378.  1995-1996 Gregg Irwin. All Rights Reserved.
  379. Option Explicit
  380. DefInt A-Z
  381. Const STYLE_OP_BUTTON = 0
  382. Const STYLE_OP_DEF_BUTTON = 1
  383. Const STYLE_OP_MODALITY = 2
  384. Const STYLE_OP_ICON = 3
  385. Const OPT_BTN_OK_ONLY = 0
  386. Const OPT_BTN_OK_CANCEL = 1
  387. Const OPT_BTN_ABORT_RETRY_IGNORE = 2
  388. Const OPT_BTN_YES_NO_CANCEL = 3
  389. Const OPT_BTN_YES_NO = 4
  390. Const OPT_BTN_RETRY_CANCEL = 5
  391. Const OPT_DEF_BTN_1 = 0
  392. Const OPT_DEF_BTN_2 = 1
  393. Const OPT_DEF_BTN_3 = 2
  394. Const OPT_DEF_BTN_4 = 3
  395. Const OPT_ICON_NONE = 0
  396. Const OPT_ICON_CRITICAL = 1
  397. Const OPT_ICON_QUESTION = 2
  398. Const OPT_ICON_EXCLAMATION = 3
  399. Const OPT_ICON_INFORMATION = 4
  400. Const OPT_MODALITY_APP = 0
  401. Const OPT_MODALITY_SYSTEM = 1
  402. Const CALL_TYPE_SUB = 0
  403. Const CALL_TYPE_FUNCTION = 1
  404. Const CALL_FORMAT_SET_PROPS_FIRST = 0
  405. Const CALL_FORMAT_USE_VALS_INLINE = 1
  406. Const DEF_OBJECT_NAME = "MB"
  407. Private mStyleOp(3) As Long         '-- selected Style options
  408. '=======================================================
  409. '== EVENTS
  410. '=======================================================
  411. Private Sub cmdClose_Click()
  412.     Unload Me
  413. End Sub
  414. Private Sub cmdGenerateCall_Click()
  415.     Dim ObjName As String
  416.     Dim GenCode As String
  417.     ObjName = txtObjectName.Text
  418.     If ObjName = "" Then
  419.         ObjName = DEF_OBJECT_NAME
  420.     End If
  421.     GenCode = ""
  422.     GenCode = GenCode & "Dim " & ObjName & " As New clsMsgBox" & vbCrLf
  423.     GenCode = GenCode & "Dim " & ObjName & "Rtn As Integer" & vbCrLf
  424.     GenCode = GenCode & vbCrLf
  425.     Select Case GetCallFormat()
  426.         Case CALL_FORMAT_SET_PROPS_FIRST
  427.             GenCode = GenCode & "With " & ObjName & vbCrLf
  428.             GenCode = GenCode & "    .Title = " & Chr$(34) & txtTitle.Text & Chr$(34) & vbCrLf
  429.             GenCode = GenCode & "    .Message = " & Chr$(34) & txtMessage.Text & Chr$(34) & vbCrLf
  430.             GenCode = GenCode & "    .Style = " & GenerateStyleCode() & vbCrLf
  431.             GenCode = GenCode & "End With" & vbCrLf
  432.             Select Case GetCallType()
  433.                 Case CALL_TYPE_SUB
  434.                     GenCode = GenCode & ObjName & ".ShowModal" & vbCrLf
  435.                 Case CALL_TYPE_FUNCTION
  436.                     GenCode = GenCode & ObjName & "Rtn = " & ObjName & ".ShowModal" & vbCrLf
  437.                     GenCode = GenCode & GenerateRtnCodeHandler(ObjName) & vbCrLf
  438.                 Case Else
  439.             End Select
  440.         Case CALL_FORMAT_USE_VALS_INLINE
  441.             Select Case GetCallType()
  442.                 Case CALL_TYPE_SUB
  443.                     GenCode = GenCode & ObjName & ".ShowModal "
  444.                     GenCode = GenCode & " StyleFlags := (" & GenerateStyleCode() & "),"
  445.                     GenCode = GenCode & " Msg := " & Chr$(34) & txtMessage.Text & Chr$(34) & ", "
  446.                     GenCode = GenCode & " BoxTitle := " & Chr$(34) & txtTitle.Text & Chr$(34)
  447.                     GenCode = GenCode & vbCrLf
  448.                 Case CALL_TYPE_FUNCTION
  449.                     GenCode = GenCode & ObjName & "Rtn = " & ObjName & ".ShowModal ("
  450.                     GenCode = GenCode & " StyleFlags := (" & GenerateStyleCode() & "),"
  451.                     GenCode = GenCode & " Msg := " & Chr$(34) & txtMessage.Text & Chr$(34) & ", "
  452.                     GenCode = GenCode & " BoxTitle := " & Chr$(34) & txtTitle.Text & Chr$(34) & ")"
  453.                     GenCode = GenCode & vbCrLf
  454.                     GenCode = GenCode & GenerateRtnCodeHandler(ObjName) & vbCrLf
  455.                 Case Else
  456.             End Select
  457.         Case Else
  458.     End Select
  459.     txtGeneratedCode = GenCode
  460.         
  461. End Sub
  462. Private Sub cmdTestMsgBox_Click()
  463.     Dim MB      As New clsMsgBox
  464.     Dim Style   As Long
  465.     Dim i       As Integer
  466.     Dim Cap     As String
  467.     Dim Msg     As String
  468.     Dim MBRtn   As Integer  '-- MsgBox Return Value
  469.     '-- Accumulate all the selected style settings
  470.     For i = LBound(mStyleOp) To UBound(mStyleOp)
  471.         Style = Style + mStyleOp(i)
  472.     Next i
  473.     '-- Set message and title
  474.     Msg = txtMessage.Text
  475.     Cap = txtTitle.Text
  476.     '-- Display the message box
  477.     MBRtn = MB.ShowModal(Msg, Style, Cap, (Me.HWnd))
  478.     '-- Display the return value
  479.     lblStatusBar.Caption = MsgBoxReturnCodeDesc(MBRtn) & " was selected"
  480. End Sub
  481. Private Sub Form_Load()
  482.     '-- Center the form on the screen
  483.     Me.Move (Screen.Width - Me.Width) \ 2, (Screen.Height - Me.Height) \ 2
  484. End Sub
  485. Private Sub optButtons_Click(Index As Integer)
  486.     '-- The control array index values just happen
  487.     '   to match the values we need.
  488.     mStyleOp(STYLE_OP_BUTTON) = Index
  489.     Select Case Index
  490.         Case OPT_BTN_OK_ONLY
  491.             Call SetCallType(CALL_TYPE_SUB)
  492.         Case Else
  493.             Call SetCallType(CALL_TYPE_FUNCTION)
  494.     End Select
  495. End Sub
  496. Private Sub optDefaultButton_Click(Index As Integer)
  497.     '-- The control array index values just happen
  498.     '   to match the values we need (when multiplied
  499.     '   by 256).
  500.     mStyleOp(STYLE_OP_DEF_BUTTON) = Index * 256
  501. End Sub
  502. Private Sub optIcon_Click(Index As Integer)
  503.     '-- The control array index values just happen
  504.     '   to match the values we need (when multiplied
  505.     '   by 16).
  506.     mStyleOp(STYLE_OP_ICON) = Index * 16
  507. End Sub
  508. Private Sub optModality_Click(Index As Integer)
  509.     '-- The control array index values just happen
  510.     '   to match the values we need (when multiplied
  511.     '   by 4096).
  512.     mStyleOp(STYLE_OP_MODALITY) = Index * 4096
  513. End Sub
  514. '=======================================================
  515. '== INTERNAL SUPPORT PROCEDURES
  516. '=======================================================
  517. ' MsgBoxReturnCodeDesc()
  518. Private Function MsgBoxReturnCodeDesc(MsgBoxRtnCode As Integer) As String
  519.     Dim Desc As String
  520.     Select Case MsgBoxRtnCode
  521.         Case vbAbort
  522.             Desc = "Abort"
  523.         Case vbCancel
  524.             Desc = "Cancel"
  525.         Case vbIgnore
  526.             Desc = "Ignore"
  527.         Case vbNo
  528.             Desc = "No"
  529.         Case vbOK
  530.             Desc = "OK"
  531.         Case vbRetry
  532.             Desc = "Retry"
  533.         Case vbYes
  534.             Desc = "Yes"
  535.         Case Else
  536.             Desc = "Unknown (" & CStr(MsgBoxRtnCode) & ")"
  537.     End Select
  538.     MsgBoxReturnCodeDesc = Desc
  539. End Function
  540. ' SetCallType
  541. Private Sub SetCallType(CallType As Integer)
  542.     Select Case CallType
  543.         Case CALL_TYPE_SUB
  544.             optCallType(0).Value = True
  545.         Case CALL_TYPE_FUNCTION
  546.             optCallType(1).Value = True
  547.         Case Else
  548.     End Select
  549. End Sub
  550. ' GetCallType()
  551. Private Function GetCallType() As Integer
  552.     If optCallType(0).Value = True Then
  553.         GetCallType = CALL_TYPE_SUB
  554.     Else
  555.         GetCallType = CALL_TYPE_FUNCTION
  556.     End If
  557. End Function
  558. ' GetCallFormat()
  559. Private Function GetCallFormat() As Integer
  560.     If optCallFormat(0).Value = True Then
  561.         GetCallFormat = CALL_FORMAT_SET_PROPS_FIRST
  562.     Else
  563.         GetCallFormat = CALL_FORMAT_USE_VALS_INLINE
  564.     End If
  565. End Function
  566. ' GetButtonStyleOption()
  567. Private Function GetButtonStyleOption() As Integer
  568.     GetButtonStyleOption = mStyleOp(STYLE_OP_BUTTON)
  569. End Function
  570. ' GetDefaultButtonStyleOption()
  571. Private Function GetDefaultButtonStyleOption() As Integer
  572.     GetDefaultButtonStyleOption = mStyleOp(STYLE_OP_DEF_BUTTON) \ 256
  573. End Function
  574. ' GetIconStyleOption()
  575. Private Function GetIconStyleOption() As Integer
  576.     GetIconStyleOption = mStyleOp(STYLE_OP_ICON) \ 16
  577. End Function
  578. ' GetModalityStyleOption()
  579. Private Function GetModalityStyleOption() As Integer
  580.     GetModalityStyleOption = mStyleOp(STYLE_OP_MODALITY) \ 4096
  581. End Function
  582. ' GenerateStyleCode()
  583. Private Function GenerateStyleCode() As String
  584.     Dim BtnStyle    As String
  585.     Dim DefBtnStyle As String
  586.     Dim IconStyle   As String
  587.     Dim ModalStyle  As String
  588.     Dim GenStyle    As String
  589.     Select Case GetButtonStyleOption()
  590.         Case OPT_BTN_OK_ONLY
  591.             BtnStyle = "vbOKOnly"
  592.         Case OPT_BTN_OK_CANCEL
  593.             BtnStyle = "vbOKCancel"
  594.         Case OPT_BTN_ABORT_RETRY_IGNORE
  595.             BtnStyle = "vbAbortRetryIgnore"
  596.         Case OPT_BTN_YES_NO_CANCEL
  597.             BtnStyle = "vbYesNoCancel"
  598.         Case OPT_BTN_YES_NO
  599.             BtnStyle = "vbYesNo"
  600.         Case OPT_BTN_RETRY_CANCEL
  601.             BtnStyle = "vbRetryCancel"
  602.         Case Else
  603.             BtnStyle = ""
  604.     End Select
  605.     Select Case GetDefaultButtonStyleOption()
  606.         Case OPT_DEF_BTN_1
  607.             '-- Default value. No need to generate code
  608.             'DefBtnStyle = "vbDefaultButton1"
  609.         Case OPT_DEF_BTN_2
  610.             DefBtnStyle = "vbDefaultButton2"
  611.         Case OPT_DEF_BTN_3
  612.             DefBtnStyle = "vbDefaultButton3"
  613.         Case OPT_DEF_BTN_4
  614.             DefBtnStyle = "vbDefaultButton4"
  615.         Case Else
  616.             DefBtnStyle = ""
  617.     End Select
  618.     Select Case GetIconStyleOption()
  619.         Case OPT_ICON_NONE
  620.             '-- Default value. No need to generate code
  621.             'IconStyle = ""
  622.         Case OPT_ICON_CRITICAL
  623.             IconStyle = "vbCritical"
  624.         Case OPT_ICON_QUESTION
  625.             IconStyle = "vbQuestion"
  626.         Case OPT_ICON_EXCLAMATION
  627.             IconStyle = "vbExclamation"
  628.         Case OPT_ICON_INFORMATION
  629.             IconStyle = "vbInformation"
  630.         Case Else
  631.             IconStyle = ""
  632.     End Select
  633.     Select Case GetModalityStyleOption()
  634.         Case OPT_MODALITY_APP
  635.             '-- Default value. No need to generate code
  636.             'ModalStyle = "vbApplicationModal"
  637.         Case OPT_MODALITY_SYSTEM
  638.             ModalStyle = "vbSystemModal"
  639.         Case Else
  640.             ModalStyle = ""
  641.     End Select
  642.     GenStyle = ""
  643.     If Len(BtnStyle) Then
  644.         GenStyle = GenStyle & BtnStyle
  645.     End If
  646.     If Len(DefBtnStyle) Then
  647.         GenStyle = GenStyle & " + " & DefBtnStyle
  648.     End If
  649.     If Len(IconStyle) Then
  650.         GenStyle = GenStyle & " + " & IconStyle
  651.     End If
  652.     If Len(ModalStyle) Then
  653.         GenStyle = GenStyle & " + " & ModalStyle
  654.     End If
  655.     GenerateStyleCode = GenStyle
  656. End Function
  657. ' GenerateRtnCodeHandler()
  658. Private Function GenerateRtnCodeHandler(ObjName As String) As String
  659.     Dim GenHandler As String
  660.     GenHandler = ""
  661.     GenHandler = "Select Case " & ObjName & "Rtn" & vbCrLf
  662.     Select Case GetButtonStyleOption()
  663.         Case OPT_BTN_OK_ONLY
  664.             GenHandler = GenHandler & "    Case vbOK" & vbCrLf
  665.         Case OPT_BTN_OK_CANCEL
  666.             GenHandler = GenHandler & "    Case vbOK" & vbCrLf
  667.             GenHandler = GenHandler & "    Case vbCancel" & vbCrLf
  668.         Case OPT_BTN_ABORT_RETRY_IGNORE
  669.             GenHandler = GenHandler & "    Case vbAbort" & vbCrLf
  670.             GenHandler = GenHandler & "    Case vbRetry" & vbCrLf
  671.             GenHandler = GenHandler & "    Case vbIgnore" & vbCrLf
  672.         Case OPT_BTN_YES_NO_CANCEL
  673.             GenHandler = GenHandler & "    Case vbYes" & vbCrLf
  674.             GenHandler = GenHandler & "    Case vbNo" & vbCrLf
  675.             GenHandler = GenHandler & "    Case vbCancel" & vbCrLf
  676.         Case OPT_BTN_YES_NO
  677.             GenHandler = GenHandler & "    Case vbYes" & vbCrLf
  678.             GenHandler = GenHandler & "    Case vbNo" & vbCrLf
  679.         Case OPT_BTN_RETRY_CANCEL
  680.             GenHandler = GenHandler & "    Case vbRetry" & vbCrLf
  681.             GenHandler = GenHandler & "    Case vbCancel" & vbCrLf
  682.         Case Else
  683.     End Select
  684.     GenHandler = GenHandler & "    Case Else" & vbCrLf
  685.     GenHandler = GenHandler & "End Select"
  686.     GenerateRtnCodeHandler = GenHandler
  687. End Function
  688.