home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / Microsoft Plateform / Visual Basic 5.0 / Msvb50.ace / msvb50 / MSVB50 / VB / WIZARDS / TEMPLATE / WIZARD.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-01-06  |  18.6 KB  |  587 lines

  1. VERSION 5.00
  2. Begin VB.Form frmWizard 
  3.    Appearance      =   0  'Flat
  4.    BorderStyle     =   3  'Fixed Dialog
  5.    Caption         =   "??? Wizard"
  6.    ClientHeight    =   5055
  7.    ClientLeft      =   1965
  8.    ClientTop       =   1815
  9.    ClientWidth     =   7155
  10.    ControlBox      =   0   'False
  11.    BeginProperty Font 
  12.       Name            =   "Tahoma"
  13.       Size            =   8.25
  14.       Charset         =   0
  15.       Weight          =   400
  16.       Underline       =   0   'False
  17.       Italic          =   0   'False
  18.       Strikethrough   =   0   'False
  19.    EndProperty
  20.    Icon            =   "Wizard.frx":0000
  21.    KeyPreview      =   -1  'True
  22.    LinkTopic       =   "Form1"
  23.    LockControls    =   -1  'True
  24.    MaxButton       =   0   'False
  25.    MinButton       =   0   'False
  26.    ScaleHeight     =   5055
  27.    ScaleWidth      =   7155
  28.    Tag             =   "10"
  29.    Begin VB.Frame fraStep 
  30.       BorderStyle     =   0  'None
  31.       Caption         =   "Introduction Screen"
  32.       Enabled         =   0   'False
  33.       BeginProperty Font 
  34.          Name            =   "MS Sans Serif"
  35.          Size            =   8.25
  36.          Charset         =   0
  37.          Weight          =   400
  38.          Underline       =   0   'False
  39.          Italic          =   0   'False
  40.          Strikethrough   =   0   'False
  41.       EndProperty
  42.       Height          =   4425
  43.       Index           =   0
  44.       Left            =   -10000
  45.       TabIndex        =   6
  46.       Tag             =   "1000"
  47.       Top             =   0
  48.       Width           =   7155
  49.       Begin VB.CheckBox chkShowIntro 
  50.          Caption         =   "chkShowIntro"
  51.          Height          =   315
  52.          Left            =   2700
  53.          MaskColor       =   &H00000000&
  54.          TabIndex        =   18
  55.          Tag             =   "1002"
  56.          Top             =   3000
  57.          Width           =   3810
  58.       End
  59.       Begin VB.Label lblStep 
  60.          Appearance      =   0  'Flat
  61.          BackColor       =   &H80000005&
  62.          BackStyle       =   0  'Transparent
  63.          Caption         =   "lblStep"
  64.          ForeColor       =   &H80000008&
  65.          Height          =   1470
  66.          Index           =   0
  67.          Left            =   2700
  68.          TabIndex        =   7
  69.          Tag             =   "1001"
  70.          Top             =   210
  71.          Width           =   3960
  72.       End
  73.       Begin VB.Image imgStep 
  74.          BorderStyle     =   1  'Fixed Single
  75.          Height          =   1995
  76.          Index           =   0
  77.          Left            =   210
  78.          Picture         =   "Wizard.frx":0442
  79.          Stretch         =   -1  'True
  80.          Top             =   210
  81.          Width           =   2070
  82.       End
  83.    End
  84.    Begin VB.Frame fraStep 
  85.       BorderStyle     =   0  'None
  86.       Caption         =   "Step 1"
  87.       Enabled         =   0   'False
  88.       BeginProperty Font 
  89.          Name            =   "MS Sans Serif"
  90.          Size            =   8.25
  91.          Charset         =   0
  92.          Weight          =   400
  93.          Underline       =   0   'False
  94.          Italic          =   0   'False
  95.          Strikethrough   =   0   'False
  96.       EndProperty
  97.       Height          =   4425
  98.       Index           =   1
  99.       Left            =   -10000
  100.       TabIndex        =   8
  101.       Tag             =   "2000"
  102.       Top             =   0
  103.       Width           =   7155
  104.       Begin VB.Label lblStep 
  105.          Appearance      =   0  'Flat
  106.          BackColor       =   &H80000005&
  107.          BackStyle       =   0  'Transparent
  108.          Caption         =   "lblStep"
  109.          ForeColor       =   &H80000008&
  110.          Height          =   1470
  111.          Index           =   1
  112.          Left            =   2700
  113.          TabIndex        =   9
  114.          Tag             =   "2001"
  115.          Top             =   210
  116.          Width           =   3960
  117.       End
  118.       Begin VB.Image imgStep 
  119.          BorderStyle     =   1  'Fixed Single
  120.          Height          =   1995
  121.          Index           =   1
  122.          Left            =   210
  123.          Picture         =   "Wizard.frx":4D18
  124.          Stretch         =   -1  'True
  125.          Top             =   210
  126.          Width           =   2070
  127.       End
  128.    End
  129.    Begin VB.Frame fraStep 
  130.       BorderStyle     =   0  'None
  131.       Caption         =   "Step 2"
  132.       Enabled         =   0   'False
  133.       BeginProperty Font 
  134.          Name            =   "MS Sans Serif"
  135.          Size            =   8.25
  136.          Charset         =   0
  137.          Weight          =   400
  138.          Underline       =   0   'False
  139.          Italic          =   0   'False
  140.          Strikethrough   =   0   'False
  141.       EndProperty
  142.       Height          =   4425
  143.       Index           =   2
  144.       Left            =   -10000
  145.       TabIndex        =   10
  146.       Tag             =   "2002"
  147.       Top             =   0
  148.       Width           =   7155
  149.       Begin VB.Label lblStep 
  150.          Appearance      =   0  'Flat
  151.          BackColor       =   &H80000005&
  152.          BackStyle       =   0  'Transparent
  153.          Caption         =   "lblStep"
  154.          ForeColor       =   &H80000008&
  155.          Height          =   1470
  156.          Index           =   2
  157.          Left            =   2700
  158.          TabIndex        =   11
  159.          Tag             =   "2003"
  160.          Top             =   210
  161.          Width           =   3960
  162.       End
  163.       Begin VB.Image imgStep 
  164.          BorderStyle     =   1  'Fixed Single
  165.          Height          =   1995
  166.          Index           =   2
  167.          Left            =   210
  168.          Picture         =   "Wizard.frx":95EE
  169.          Stretch         =   -1  'True
  170.          Top             =   210
  171.          Width           =   2070
  172.       End
  173.    End
  174.    Begin VB.Frame fraStep 
  175.       BorderStyle     =   0  'None
  176.       Caption         =   "Step 3"
  177.       Enabled         =   0   'False
  178.       BeginProperty Font 
  179.          Name            =   "MS Sans Serif"
  180.          Size            =   8.25
  181.          Charset         =   0
  182.          Weight          =   400
  183.          Underline       =   0   'False
  184.          Italic          =   0   'False
  185.          Strikethrough   =   0   'False
  186.       EndProperty
  187.       Height          =   4425
  188.       Index           =   3
  189.       Left            =   -10000
  190.       TabIndex        =   12
  191.       Tag             =   "2004"
  192.       Top             =   0
  193.       Width           =   7155
  194.       Begin VB.Label lblStep 
  195.          Appearance      =   0  'Flat
  196.          BackColor       =   &H80000005&
  197.          BackStyle       =   0  'Transparent
  198.          Caption         =   "lblStep"
  199.          ForeColor       =   &H80000008&
  200.          Height          =   1470
  201.          Index           =   3
  202.          Left            =   2700
  203.          TabIndex        =   13
  204.          Tag             =   "2005"
  205.          Top             =   210
  206.          Width           =   3960
  207.       End
  208.       Begin VB.Image imgStep 
  209.          BorderStyle     =   1  'Fixed Single
  210.          Height          =   1995
  211.          Index           =   3
  212.          Left            =   210
  213.          Picture         =   "Wizard.frx":DEC4
  214.          Stretch         =   -1  'True
  215.          Top             =   210
  216.          Width           =   2070
  217.       End
  218.    End
  219.    Begin VB.Frame fraStep 
  220.       BorderStyle     =   0  'None
  221.       Caption         =   "Step 4"
  222.       Enabled         =   0   'False
  223.       BeginProperty Font 
  224.          Name            =   "MS Sans Serif"
  225.          Size            =   8.25
  226.          Charset         =   0
  227.          Weight          =   400
  228.          Underline       =   0   'False
  229.          Italic          =   0   'False
  230.          Strikethrough   =   0   'False
  231.       EndProperty
  232.       Height          =   4425
  233.       Index           =   4
  234.       Left            =   -10000
  235.       TabIndex        =   14
  236.       Tag             =   "2006"
  237.       Top             =   0
  238.       Width           =   7155
  239.       Begin VB.Label lblStep 
  240.          Appearance      =   0  'Flat
  241.          BackColor       =   &H80000005&
  242.          BackStyle       =   0  'Transparent
  243.          Caption         =   "lblStep"
  244.          ForeColor       =   &H80000008&
  245.          Height          =   1470
  246.          Index           =   4
  247.          Left            =   2700
  248.          TabIndex        =   15
  249.          Tag             =   "2007"
  250.          Top             =   210
  251.          Width           =   3960
  252.       End
  253.       Begin VB.Image imgStep 
  254.          BorderStyle     =   1  'Fixed Single
  255.          Height          =   1995
  256.          Index           =   4
  257.          Left            =   210
  258.          Picture         =   "Wizard.frx":1279A
  259.          Stretch         =   -1  'True
  260.          Top             =   210
  261.          Width           =   2070
  262.       End
  263.    End
  264.    Begin VB.Frame fraStep 
  265.       BorderStyle     =   0  'None
  266.       Caption         =   "Finished!"
  267.       Enabled         =   0   'False
  268.       BeginProperty Font 
  269.          Name            =   "MS Sans Serif"
  270.          Size            =   8.25
  271.          Charset         =   0
  272.          Weight          =   400
  273.          Underline       =   0   'False
  274.          Italic          =   0   'False
  275.          Strikethrough   =   0   'False
  276.       EndProperty
  277.       Height          =   4425
  278.       Index           =   5
  279.       Left            =   -10000
  280.       TabIndex        =   16
  281.       Tag             =   "3000"
  282.       Top             =   0
  283.       Width           =   7155
  284.       Begin VB.CheckBox chkSaveSettings 
  285.          Caption         =   "chkSaveSettings"
  286.          Height          =   552
  287.          Left            =   3210
  288.          MaskColor       =   &H00000000&
  289.          TabIndex        =   19
  290.          Tag             =   "3003"
  291.          Top             =   1650
  292.          Width           =   3552
  293.       End
  294.       Begin VB.Label lblStep 
  295.          Appearance      =   0  'Flat
  296.          BackColor       =   &H80000005&
  297.          BackStyle       =   0  'Transparent
  298.          Caption         =   "lblStep"
  299.          ForeColor       =   &H80000008&
  300.          Height          =   1470
  301.          Index           =   5
  302.          Left            =   3210
  303.          TabIndex        =   17
  304.          Tag             =   "3001"
  305.          Top             =   210
  306.          Width           =   3960
  307.       End
  308.       Begin VB.Image imgStep 
  309.          BorderStyle     =   1  'Fixed Single
  310.          Height          =   3075
  311.          Index           =   5
  312.          Left            =   210
  313.          Picture         =   "Wizard.frx":17070
  314.          Stretch         =   -1  'True
  315.          Top             =   210
  316.          Width           =   2430
  317.       End
  318.    End
  319.    Begin VB.PictureBox picNav 
  320.       Align           =   2  'Align Bottom
  321.       Appearance      =   0  'Flat
  322.       BorderStyle     =   0  'None
  323.       BeginProperty Font 
  324.          Name            =   "MS Sans Serif"
  325.          Size            =   8.25
  326.          Charset         =   0
  327.          Weight          =   400
  328.          Underline       =   0   'False
  329.          Italic          =   0   'False
  330.          Strikethrough   =   0   'False
  331.       EndProperty
  332.       ForeColor       =   &H80000008&
  333.       Height          =   570
  334.       Left            =   0
  335.       ScaleHeight     =   570
  336.       ScaleWidth      =   7155
  337.       TabIndex        =   0
  338.       Top             =   4485
  339.       Width           =   7155
  340.       Begin VB.CommandButton cmdNav 
  341.          Caption         =   "&Finish"
  342.          Height          =   312
  343.          Index           =   4
  344.          Left            =   5910
  345.          MaskColor       =   &H00000000&
  346.          TabIndex        =   5
  347.          Tag             =   "104"
  348.          Top             =   120
  349.          Width           =   1092
  350.       End
  351.       Begin VB.CommandButton cmdNav 
  352.          Caption         =   "&Next >"
  353.          Height          =   312
  354.          Index           =   3
  355.          Left            =   4545
  356.          MaskColor       =   &H00000000&
  357.          TabIndex        =   4
  358.          Tag             =   "103"
  359.          Top             =   120
  360.          Width           =   1092
  361.       End
  362.       Begin VB.CommandButton cmdNav 
  363.          Caption         =   "< &Back"
  364.          Height          =   312
  365.          Index           =   2
  366.          Left            =   3435
  367.          MaskColor       =   &H00000000&
  368.          TabIndex        =   3
  369.          Tag             =   "102"
  370.          Top             =   120
  371.          Width           =   1092
  372.       End
  373.       Begin VB.CommandButton cmdNav 
  374.          Cancel          =   -1  'True
  375.          Caption         =   "Cancel"
  376.          Height          =   312
  377.          Index           =   1
  378.          Left            =   2250
  379.          MaskColor       =   &H00000000&
  380.          TabIndex        =   2
  381.          Tag             =   "101"
  382.          Top             =   120
  383.          Width           =   1092
  384.       End
  385.       Begin VB.CommandButton cmdNav 
  386.          Caption         =   "Help"
  387.          Height          =   312
  388.          Index           =   0
  389.          Left            =   108
  390.          MaskColor       =   &H00000000&
  391.          TabIndex        =   1
  392.          Tag             =   "100"
  393.          Top             =   120
  394.          Width           =   1092
  395.       End
  396.       Begin VB.Line Line1 
  397.          BorderColor     =   &H00808080&
  398.          Index           =   1
  399.          X1              =   108
  400.          X2              =   7012
  401.          Y1              =   0
  402.          Y2              =   0
  403.       End
  404.       Begin VB.Line Line1 
  405.          BorderColor     =   &H00FFFFFF&
  406.          Index           =   0
  407.          X1              =   108
  408.          X2              =   7012
  409.          Y1              =   24
  410.          Y2              =   24
  411.       End
  412.    End
  413. Attribute VB_Name = "frmWizard"
  414. Attribute VB_GlobalNameSpace = False
  415. Attribute VB_Creatable = False
  416. Attribute VB_PredeclaredId = True
  417. Attribute VB_Exposed = False
  418. Option Explicit
  419. Const NUM_STEPS = 6
  420. Const RES_ERROR_MSG = 30000
  421. 'BASE VALUE FOR HELP FILE FOR THIS WIZARD:
  422. Const HELP_BASE = 1000
  423. Const HELP_FILE = "MYWIZARD.HLP"
  424. Const BTN_HELP = 0
  425. Const BTN_CANCEL = 1
  426. Const BTN_BACK = 2
  427. Const BTN_NEXT = 3
  428. Const BTN_FINISH = 4
  429. Const STEP_INTRO = 0
  430. Const STEP_1 = 1
  431. Const STEP_2 = 2
  432. Const STEP_3 = 3
  433. Const STEP_4 = 4
  434. Const STEP_FINISH = 5
  435. Const DIR_NONE = 0
  436. Const DIR_BACK = 1
  437. Const DIR_NEXT = 2
  438. Const FRM_TITLE = "Blank Wizard"
  439. Const INTRO_KEY = "IntroductionScreen"
  440. Const SHOW_INTRO = "ShowIntro"
  441. Const TOPIC_TEXT = "<TOPIC_TEXT>"
  442. 'module level vars
  443. Dim mnCurStep       As Integer
  444. Dim mbHelpStarted   As Boolean
  445. Public VBInst       As VBIDE.VBE
  446. Dim mbFinishOK      As Boolean
  447. Private Sub chkShowIntro_Click()
  448.     If chkShowIntro.Value Then
  449.         SaveSetting APP_CATEGORY, WIZARD_NAME, INTRO_KEY, SHOW_INTRO
  450.     Else
  451.         SaveSetting APP_CATEGORY, WIZARD_NAME, INTRO_KEY, vbNullString
  452.     End If
  453. End Sub
  454. Private Sub cmdNav_Click(Index As Integer)
  455.     Dim nAltStep As Integer
  456.     Dim lHelpTopic As Long
  457.     Dim rc As Long
  458.     Select Case Index
  459.         Case BTN_HELP
  460.             mbHelpStarted = True
  461.             lHelpTopic = HELP_BASE + 10 * (1 + mnCurStep)
  462.             rc = WinHelp(Me.hwnd, HELP_FILE, HELP_CONTEXT, lHelpTopic)
  463.         
  464.         Case BTN_CANCEL
  465.             Unload Me
  466.           
  467.         Case BTN_BACK
  468.             'place special cases here to jump
  469.             'to alternate steps
  470.             nAltStep = mnCurStep - 1
  471.             SetStep nAltStep, DIR_BACK
  472.           
  473.         Case BTN_NEXT
  474.             'place special cases here to jump
  475.             'to alternate steps
  476.             nAltStep = mnCurStep + 1
  477.             SetStep nAltStep, DIR_NEXT
  478.           
  479.         Case BTN_FINISH
  480.             'wizard creation code goes here
  481.       
  482.             Unload Me
  483.             
  484.             If GetSetting(APP_CATEGORY, WIZARD_NAME, CONFIRM_KEY, vbNullString) = vbNullString Then
  485.                 frmConfirm.Show vbModal
  486.             End If
  487.         
  488.     End Select
  489. End Sub
  490. Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
  491.     If KeyCode = vbKeyF1 Then
  492.         cmdNav_Click BTN_HELP
  493.     End If
  494. End Sub
  495. Private Sub Form_Load()
  496.     Dim i As Integer
  497.     'init all vars
  498.     mbFinishOK = False
  499.     For i = 0 To NUM_STEPS - 1
  500.       fraStep(i).Left = -10000
  501.     Next
  502.     'Load All string info for Form
  503.     LoadResStrings Me
  504.     'Determine 1st Step:
  505.     If GetSetting(APP_CATEGORY, WIZARD_NAME, INTRO_KEY, vbNullString) = SHOW_INTRO Then
  506.         chkShowIntro.Value = vbChecked
  507.         SetStep 1, DIR_NEXT
  508.     Else
  509.         SetStep 0, DIR_NONE
  510.     End If
  511. End Sub
  512. Private Sub SetStep(nStep As Integer, nDirection As Integer)
  513.     Select Case nStep
  514.         Case STEP_INTRO
  515.       
  516.         Case STEP_1
  517.       
  518.         Case STEP_2
  519.         
  520.         Case STEP_3
  521.       
  522.         Case STEP_4
  523.             mbFinishOK = False
  524.       
  525.         Case STEP_FINISH
  526.             mbFinishOK = True
  527.         
  528.     End Select
  529.     'move to new step
  530.     fraStep(mnCurStep).Enabled = False
  531.     fraStep(nStep).Left = 0
  532.     If nStep <> mnCurStep Then
  533.         fraStep(mnCurStep).Left = -10000
  534.     End If
  535.     fraStep(nStep).Enabled = True
  536.     SetCaption nStep
  537.     SetNavBtns nStep
  538. End Sub
  539. Private Sub SetNavBtns(nStep As Integer)
  540.     mnCurStep = nStep
  541.     If mnCurStep = 0 Then
  542.         cmdNav(BTN_BACK).Enabled = False
  543.         cmdNav(BTN_NEXT).Enabled = True
  544.     ElseIf mnCurStep = NUM_STEPS - 1 Then
  545.         cmdNav(BTN_NEXT).Enabled = False
  546.         cmdNav(BTN_BACK).Enabled = True
  547.     Else
  548.         cmdNav(BTN_BACK).Enabled = True
  549.         cmdNav(BTN_NEXT).Enabled = True
  550.     End If
  551.     If mbFinishOK Then
  552.         cmdNav(BTN_FINISH).Enabled = True
  553.     Else
  554.         cmdNav(BTN_FINISH).Enabled = False
  555.     End If
  556. End Sub
  557. Private Sub SetCaption(nStep As Integer)
  558.     On Error Resume Next
  559.     Me.Caption = FRM_TITLE & " - " & LoadResString(fraStep(nStep).Tag)
  560. End Sub
  561. '=========================================================
  562. 'this sub displays an error message when the user has
  563. 'not entered enough data to continue
  564. '=========================================================
  565. Sub IncompleteData(nIndex As Integer)
  566.     On Error Resume Next
  567.     Dim sTmp As String
  568.       
  569.     'get the base error message
  570.     sTmp = LoadResString(RES_ERROR_MSG)
  571.     'get the specific message
  572.     sTmp = sTmp & vbCrLf & LoadResString(RES_ERROR_MSG + nIndex)
  573.     Beep
  574.     MsgBox sTmp, vbInformation
  575. End Sub
  576. Private Sub Form_Unload(Cancel As Integer)
  577.     On Error Resume Next
  578.     Dim rc As Long
  579.     'see if we need to save the settings
  580.     If chkSaveSettings.Value = vbChecked Then
  581.       
  582. '        SaveSetting APP_CATEGORY, WIZARD_NAME, "OptionName", Option Value
  583.       
  584.     End If
  585.     If mbHelpStarted Then rc = WinHelp(Me.hwnd, HELP_FILE, HELP_QUIT, 0)
  586. End Sub
  587.