home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / vb_code1 / infocus / demo.frm < prev    next >
Text File  |  1994-04-07  |  21KB  |  643 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "Employee Information"
  5.    ClientHeight    =   3660
  6.    ClientLeft      =   1290
  7.    ClientTop       =   1725
  8.    ClientWidth     =   7095
  9.    Height          =   4350
  10.    Icon            =   DEMO.FRX:0000
  11.    Left            =   1230
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   3660
  14.    ScaleWidth      =   7095
  15.    Top             =   1095
  16.    Width           =   7215
  17.    Begin PictureBox picEventInfo 
  18.       BackColor       =   &H00C0C0C0&
  19.       BorderStyle     =   0  'None
  20.       Height          =   615
  21.       Left            =   2760
  22.       ScaleHeight     =   615
  23.       ScaleWidth      =   3975
  24.       TabIndex        =   25
  25.       TabStop         =   0   'False
  26.       Top             =   2520
  27.       Visible         =   0   'False
  28.       Width           =   3975
  29.       Begin Label lblEventCaption 
  30.          Alignment       =   1  'Right Justify
  31.          BackColor       =   &H00C0C0C0&
  32.          BackStyle       =   0  'Transparent
  33.          Caption         =   "Event:"
  34.          Height          =   255
  35.          Left            =   0
  36.          TabIndex        =   20
  37.          Top             =   0
  38.          Width           =   1095
  39.       End
  40.       Begin Label lblControlCaption 
  41.          Alignment       =   1  'Right Justify
  42.          BackColor       =   &H00C0C0C0&
  43.          BackStyle       =   0  'Transparent
  44.          Caption         =   "Control:"
  45.          Height          =   255
  46.          Left            =   0
  47.          TabIndex        =   21
  48.          Top             =   240
  49.          Width           =   1095
  50.       End
  51.       Begin Label lblEvent 
  52.          BackColor       =   &H00C0C0C0&
  53.          BackStyle       =   0  'Transparent
  54.          ForeColor       =   &H00000000&
  55.          Height          =   255
  56.          Left            =   1200
  57.          TabIndex        =   22
  58.          Top             =   0
  59.          Width           =   2775
  60.       End
  61.       Begin Label lblControl 
  62.          BackColor       =   &H00C0C0C0&
  63.          BackStyle       =   0  'Transparent
  64.          ForeColor       =   &H00000000&
  65.          Height          =   255
  66.          Left            =   1200
  67.          TabIndex        =   23
  68.          Top             =   240
  69.          Width           =   2775
  70.       End
  71.    End
  72.    Begin CheckBox chkShowEvents 
  73.       BackColor       =   &H00C0C0C0&
  74.       Caption         =   "Show VB Events"
  75.       Height          =   255
  76.       Left            =   240
  77.       TabIndex        =   24
  78.       TabStop         =   0   'False
  79.       Top             =   2520
  80.       Width           =   1815
  81.    End
  82.    Begin TextBox txtZip 
  83.       FontBold        =   -1  'True
  84.       FontItalic      =   0   'False
  85.       FontName        =   "MS Sans Serif"
  86.       FontSize        =   9.75
  87.       FontStrikethru  =   0   'False
  88.       FontUnderline   =   0   'False
  89.       Height          =   360
  90.       Left            =   3960
  91.       TabIndex        =   18
  92.       Tag             =   "Enter the employee's zip code"
  93.       Top             =   2040
  94.       Width           =   1455
  95.    End
  96.    Begin TextBox txtState 
  97.       FontBold        =   -1  'True
  98.       FontItalic      =   0   'False
  99.       FontName        =   "MS Sans Serif"
  100.       FontSize        =   9.75
  101.       FontStrikethru  =   0   'False
  102.       FontUnderline   =   0   'False
  103.       Height          =   360
  104.       Left            =   3240
  105.       TabIndex        =   16
  106.       Tag             =   "Enter the employee's state"
  107.       Top             =   2040
  108.       Width           =   615
  109.    End
  110.    Begin TextBox txtCity 
  111.       FontBold        =   -1  'True
  112.       FontItalic      =   0   'False
  113.       FontName        =   "MS Sans Serif"
  114.       FontSize        =   9.75
  115.       FontStrikethru  =   0   'False
  116.       FontUnderline   =   0   'False
  117.       Height          =   360
  118.       Left            =   240
  119.       TabIndex        =   14
  120.       Tag             =   "Enter the employee's city"
  121.       Top             =   2040
  122.       Width           =   2895
  123.    End
  124.    Begin TextBox txtAddress 
  125.       FontBold        =   -1  'True
  126.       FontItalic      =   0   'False
  127.       FontName        =   "MS Sans Serif"
  128.       FontSize        =   9.75
  129.       FontStrikethru  =   0   'False
  130.       FontUnderline   =   0   'False
  131.       Height          =   360
  132.       Left            =   240
  133.       TabIndex        =   12
  134.       Tag             =   "Enter the employee's street address"
  135.       Top             =   1440
  136.       Width           =   5175
  137.    End
  138.    Begin InFocus InFocus1 
  139.       Left            =   240
  140.       Top             =   2880
  141.    End
  142.    Begin TextBox txtLastName 
  143.       FontBold        =   -1  'True
  144.       FontItalic      =   0   'False
  145.       FontName        =   "MS Sans Serif"
  146.       FontSize        =   9.75
  147.       FontStrikethru  =   0   'False
  148.       FontUnderline   =   0   'False
  149.       Height          =   360
  150.       Left            =   240
  151.       TabIndex        =   0
  152.       Tag             =   "Enter the employee's last name"
  153.       Top             =   840
  154.       Width           =   2895
  155.    End
  156.    Begin PictureBox picButtonBar 
  157.       Align           =   1  'Align Top
  158.       BackColor       =   &H00C0C0C0&
  159.       BorderStyle     =   0  'None
  160.       Height          =   525
  161.       Left            =   0
  162.       ScaleHeight     =   525
  163.       ScaleWidth      =   7095
  164.       TabIndex        =   5
  165.       TabStop         =   0   'False
  166.       Top             =   0
  167.       Width           =   7095
  168.       Begin CommandButton btnLocate 
  169.          BackColor       =   &H00C0C0C0&
  170.          Caption         =   "&Locate"
  171.          FontBold        =   -1  'True
  172.          FontItalic      =   0   'False
  173.          FontName        =   "MS Sans Serif"
  174.          FontSize        =   9.75
  175.          FontStrikethru  =   0   'False
  176.          FontUnderline   =   0   'False
  177.          Height          =   495
  178.          Left            =   3240
  179.          TabIndex        =   9
  180.          TabStop         =   0   'False
  181.          Tag             =   "Locate a specific employee"
  182.          Top             =   0
  183.          Width           =   1095
  184.       End
  185.       Begin CommandButton btnSave 
  186.          BackColor       =   &H00C0C0C0&
  187.          Caption         =   "&Save"
  188.          FontBold        =   -1  'True
  189.          FontItalic      =   0   'False
  190.          FontName        =   "MS Sans Serif"
  191.          FontSize        =   9.75
  192.          FontStrikethru  =   0   'False
  193.          FontUnderline   =   0   'False
  194.          Height          =   495
  195.          Left            =   2160
  196.          TabIndex        =   8
  197.          TabStop         =   0   'False
  198.          Tag             =   "Save any changes"
  199.          Top             =   0
  200.          Width           =   1095
  201.       End
  202.       Begin CommandButton btnDelete 
  203.          BackColor       =   &H00C0C0C0&
  204.          Caption         =   "&Delete"
  205.          FontBold        =   -1  'True
  206.          FontItalic      =   0   'False
  207.          FontName        =   "MS Sans Serif"
  208.          FontSize        =   9.75
  209.          FontStrikethru  =   0   'False
  210.          FontUnderline   =   0   'False
  211.          Height          =   495
  212.          Left            =   1080
  213.          TabIndex        =   7
  214.          TabStop         =   0   'False
  215.          Tag             =   "Delete the current employee"
  216.          Top             =   0
  217.          Width           =   1095
  218.       End
  219.       Begin CommandButton btnAdd 
  220.          BackColor       =   &H00C0C0C0&
  221.          Caption         =   "&Add"
  222.          FontBold        =   -1  'True
  223.          FontItalic      =   0   'False
  224.          FontName        =   "MS Sans Serif"
  225.          FontSize        =   9.75
  226.          FontStrikethru  =   0   'False
  227.          FontUnderline   =   0   'False
  228.          Height          =   495
  229.          Left            =   0
  230.          TabIndex        =   6
  231.          TabStop         =   0   'False
  232.          Tag             =   "Add a new employee"
  233.          Top             =   0
  234.          Width           =   1095
  235.       End
  236.       Begin Label Label1 
  237.          BackStyle       =   0  'Transparent
  238.          Caption         =   "InFocus Demo"
  239.          FontBold        =   -1  'True
  240.          FontItalic      =   0   'False
  241.          FontName        =   "MS Sans Serif"
  242.          FontSize        =   15
  243.          FontStrikethru  =   0   'False
  244.          FontUnderline   =   -1  'True
  245.          Height          =   375
  246.          Left            =   4560
  247.          TabIndex        =   11
  248.          Top             =   120
  249.          Width           =   2295
  250.       End
  251.    End
  252.    Begin TextBox txtFirstName 
  253.       FontBold        =   -1  'True
  254.       FontItalic      =   0   'False
  255.       FontName        =   "MS Sans Serif"
  256.       FontSize        =   9.75
  257.       FontStrikethru  =   0   'False
  258.       FontUnderline   =   0   'False
  259.       Height          =   360
  260.       Left            =   3240
  261.       TabIndex        =   1
  262.       Tag             =   "Enter the employee's first name and middle initial"
  263.       Top             =   840
  264.       Width           =   2175
  265.    End
  266.    Begin PictureBox picHelp 
  267.       Align           =   2  'Align Bottom
  268.       BackColor       =   &H00C0C0C0&
  269.       Height          =   300
  270.       Left            =   0
  271.       ScaleHeight     =   270
  272.       ScaleWidth      =   7065
  273.       TabIndex        =   2
  274.       TabStop         =   0   'False
  275.       Top             =   3360
  276.       Width           =   7095
  277.       Begin Label lblHelp 
  278.          BackColor       =   &H00C0C0C0&
  279.          BackStyle       =   0  'Transparent
  280.          FontBold        =   -1  'True
  281.          FontItalic      =   0   'False
  282.          FontName        =   "MS Sans Serif"
  283.          FontSize        =   9.75
  284.          FontStrikethru  =   0   'False
  285.          FontUnderline   =   0   'False
  286.          Height          =   255
  287.          Left            =   120
  288.          TabIndex        =   3
  289.          Top             =   0
  290.          Width           =   6735
  291.       End
  292.    End
  293.    Begin Label lblZip 
  294.       BackColor       =   &H00C0C0C0&
  295.       BackStyle       =   0  'Transparent
  296.       Caption         =   "Zip Code:"
  297.       FontBold        =   -1  'True
  298.       FontItalic      =   0   'False
  299.       FontName        =   "MS Sans Serif"
  300.       FontSize        =   9.75
  301.       FontStrikethru  =   0   'False
  302.       FontUnderline   =   0   'False
  303.       Height          =   255
  304.       Left            =   3960
  305.       TabIndex        =   19
  306.       Top             =   1800
  307.       Width           =   1335
  308.    End
  309.    Begin Label lblState 
  310.       BackColor       =   &H00C0C0C0&
  311.       BackStyle       =   0  'Transparent
  312.       Caption         =   "State:"
  313.       FontBold        =   -1  'True
  314.       FontItalic      =   0   'False
  315.       FontName        =   "MS Sans Serif"
  316.       FontSize        =   9.75
  317.       FontStrikethru  =   0   'False
  318.       FontUnderline   =   0   'False
  319.       Height          =   255
  320.       Left            =   3240
  321.       TabIndex        =   17
  322.       Top             =   1800
  323.       Width           =   735
  324.    End
  325.    Begin Label lblCity 
  326.       BackColor       =   &H00C0C0C0&
  327.       BackStyle       =   0  'Transparent
  328.       Caption         =   "City:"
  329.       FontBold        =   -1  'True
  330.       FontItalic      =   0   'False
  331.       FontName        =   "MS Sans Serif"
  332.       FontSize        =   9.75
  333.       FontStrikethru  =   0   'False
  334.       FontUnderline   =   0   'False
  335.       Height          =   255
  336.       Left            =   240
  337.       TabIndex        =   15
  338.       Top             =   1800
  339.       Width           =   1335
  340.    End
  341.    Begin Label lblAddress 
  342.       BackColor       =   &H00C0C0C0&
  343.       BackStyle       =   0  'Transparent
  344.       Caption         =   "Address:"
  345.       FontBold        =   -1  'True
  346.       FontItalic      =   0   'False
  347.       FontName        =   "MS Sans Serif"
  348.       FontSize        =   9.75
  349.       FontStrikethru  =   0   'False
  350.       FontUnderline   =   0   'False
  351.       Height          =   255
  352.       Left            =   240
  353.       TabIndex        =   13
  354.       Top             =   1200
  355.       Width           =   1335
  356.    End
  357.    Begin Label lblLastName 
  358.       BackColor       =   &H00C0C0C0&
  359.       BackStyle       =   0  'Transparent
  360.       Caption         =   "Last Name:"
  361.       FontBold        =   -1  'True
  362.       FontItalic      =   0   'False
  363.       FontName        =   "MS Sans Serif"
  364.       FontSize        =   9.75
  365.       FontStrikethru  =   0   'False
  366.       FontUnderline   =   0   'False
  367.       Height          =   255
  368.       Left            =   240
  369.       TabIndex        =   10
  370.       Top             =   600
  371.       Width           =   1335
  372.    End
  373.    Begin Label lblFirstName 
  374.       BackColor       =   &H00C0C0C0&
  375.       BackStyle       =   0  'Transparent
  376.       Caption         =   "First Name:"
  377.       FontBold        =   -1  'True
  378.       FontItalic      =   0   'False
  379.       FontName        =   "MS Sans Serif"
  380.       FontSize        =   9.75
  381.       FontStrikethru  =   0   'False
  382.       FontUnderline   =   0   'False
  383.       Height          =   255
  384.       Left            =   3240
  385.       TabIndex        =   4
  386.       Top             =   600
  387.       Width           =   1335
  388.    End
  389.    Begin Menu mnuFile 
  390.       Caption         =   "&File"
  391.       Begin Menu mnuFilePrint 
  392.          Caption         =   "&Print..."
  393.          Shortcut        =   ^P
  394.       End
  395.       Begin Menu mnuFilePrintSetup 
  396.          Caption         =   "Print &Setup..."
  397.       End
  398.       Begin Menu mnuFileSep1 
  399.          Caption         =   "-"
  400.       End
  401.       Begin Menu mnuFileExit 
  402.          Caption         =   "E&xit"
  403.       End
  404.    End
  405.    Begin Menu mnuEdit 
  406.       Caption         =   "&Edit"
  407.       Begin Menu mnuEditUndo 
  408.          Caption         =   "&Undo"
  409.          Shortcut        =   ^Z
  410.       End
  411.       Begin Menu mnuEditSep1 
  412.          Caption         =   "-"
  413.       End
  414.       Begin Menu mnuEditCut 
  415.          Caption         =   "Cu&t"
  416.          Shortcut        =   ^X
  417.       End
  418.       Begin Menu mnuEditCopy 
  419.          Caption         =   "&Copy"
  420.          Shortcut        =   ^C
  421.       End
  422.       Begin Menu mnuEditPaste 
  423.          Caption         =   "&Paste"
  424.          Shortcut        =   ^V
  425.       End
  426.       Begin Menu mnuEditDelete 
  427.          Caption         =   "&Delete"
  428.          Shortcut        =   {DEL}
  429.       End
  430.    End
  431.    Begin Menu mnuHelp 
  432.       Caption         =   "&Help"
  433.       Begin Menu mnuHelpContents 
  434.          Caption         =   "&Contents"
  435.       End
  436.       Begin Menu mnuHelpSearch 
  437.          Caption         =   "&Search for Help on..."
  438.       End
  439.       Begin Menu mnuHelpHelp 
  440.          Caption         =   "&How to Use Help"
  441.       End
  442.       Begin Menu mnuHelpSep1 
  443.          Caption         =   "-"
  444.       End
  445.       Begin Menu mnuHelpAbout 
  446.          Caption         =   "&About Employee Information..."
  447.       End
  448.    End
  449. End
  450. Option Explicit
  451.  
  452. Declare Function WinHelp Lib "User" (ByVal hWnd As Integer, ByVal lpHelpFile As String, ByVal wCommand As Integer, dwData As Any) As Integer
  453.  
  454. Dim ctlFocus As Control
  455.  
  456. Sub btnAdd_Click ()
  457.     ctlFocus.SetFocus
  458.     DoEvents
  459.     lblHelp = "Adding a new employeee..."
  460. End Sub
  461.  
  462. Sub btnAdd_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single)
  463.     ctlFocus.SetFocus
  464. End Sub
  465.  
  466. Sub btnDelete_Click ()
  467.     ctlFocus.SetFocus
  468.     DoEvents
  469.     lblHelp = "The employee has been deleted..."
  470. End Sub
  471.  
  472. Sub btnDelete_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single)
  473.     ctlFocus.SetFocus
  474. End Sub
  475.  
  476. Sub btnLocate_Click ()
  477.     ctlFocus.SetFocus
  478.     DoEvents
  479.     lblHelp = "The employee has been located..."
  480. End Sub
  481.  
  482. Sub btnLocate_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single)
  483.     ctlFocus.SetFocus
  484. End Sub
  485.  
  486. Sub btnSave_Click ()
  487.     ctlFocus.SetFocus
  488.     DoEvents
  489.     lblHelp = "Changes have been saved..."
  490. End Sub
  491.  
  492. Sub btnSave_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single)
  493.     ctlFocus.SetFocus
  494. End Sub
  495.  
  496. Sub chkShowEvents_Click ()
  497.     picEventInfo.Visible = chkShowEvents
  498.     ctlFocus.SetFocus
  499. End Sub
  500.  
  501. Sub chkShowEvents_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single)
  502.     ctlFocus.SetFocus
  503. End Sub
  504.  
  505. Sub Form_Load ()
  506.     Set ctlFocus = txtLastName
  507.     lblHelp = ctlFocus.Tag
  508. End Sub
  509.  
  510. Sub InFocus1_FocusChange (ctlName As String, CtlIndex As Integer, CtlTag As String, CtlHwnd As Integer)
  511.     lblEvent = "FocusChange"
  512.     lblControl = ctlName
  513.     Select Case ctlName
  514.         Case "txtLastName"
  515.             Set ctlFocus = txtLastName
  516.         Case "txtFirstName"
  517.             Set ctlFocus = txtFirstName
  518.         Case "txtAddress"
  519.             Set ctlFocus = txtAddress
  520.         Case "txtCity"
  521.             Set ctlFocus = txtCity
  522.         Case "txtState"
  523.             Set ctlFocus = txtState
  524.         Case "txtZip"
  525.             Set ctlFocus = txtZip
  526.     End Select
  527.     lblHelp = CtlTag
  528. End Sub
  529.  
  530. Sub InFocus1_MenuSelect (MenuText As String)
  531.     lblEvent = "MenuSelect"
  532.     lblControl = StripTabs(MenuText)
  533.     Select Case MenuText
  534.         Case "&File"
  535.             lblHelp = "Print, Printer Setup, Exit..."
  536.         Case "&Print..." & Chr(9) & "Ctrl+P"
  537.             lblHelp = "Print the current form"
  538.         Case "Print &Setup..."
  539.             lblHelp = "Select a printer or change printer settings"
  540.         Case "E&xit"
  541.             lblHelp = "Exit Employee Information"
  542.         Case "&Edit"
  543.             lblHelp = "Make editing changes to the current field"
  544.         Case "&Undo" & Chr(9) & "Ctrl+Z"
  545.             lblHelp = "Undo the last change"
  546.         Case "Cu&t" & Chr(9) & "Ctrl+X"
  547.             lblHelp = "Delete selected text and copy it to the clipboard"
  548.         Case "&Copy" & Chr(9) & "Ctrl+C"
  549.             lblHelp = "Copy selected text to the clipboard"
  550.         Case "&Paste" & Chr(9) & "Ctrl+V"
  551.             lblHelp = "Insert the contents of the clipboard"
  552.         Case "&Delete" & Chr(9) & "Del"
  553.             lblHelp = "Delete selected text"
  554.         Case "&Help"
  555.             lblHelp = "Receive detailed help"
  556.         Case "&Contents"
  557.             lblHelp = "Show the help table of contents"
  558.         Case "&Search for Help on..."
  559.             lblHelp = "Search for help on specific keywords"
  560.         Case "&How to Use Help"
  561.             lblHelp = "Instructions on using Windows Help"
  562.         Case "&About Employee Information..."
  563.             lblHelp = "Display version number and other information"
  564.         Case "[CANCEL]"
  565.             lblHelp = ctlFocus.Tag
  566.         Case "[SYSMENU]"
  567.             lblHelp = "Do stuff to the window"
  568.         Case "&Restore"
  569.             lblHelp = "Restore window to previous size"
  570.         Case "&Move"
  571.             lblHelp = "Move the window"
  572.         Case "&Size"
  573.             lblHelp = "Size the window"
  574.         Case "Mi&nimize"
  575.             lblHelp = "Reduce the window to an icon"
  576.         Case "Ma&ximize"
  577.             lblHelp = "Make the window full-screen"
  578.         Case "&Close" & Chr(9) & "Alt+F4"
  579.             lblHelp = "Close the window"
  580.         Case "S&witch To..." & Chr(9) & "Ctrl+Esc"
  581.             lblHelp = "Switch to another application"
  582.         Case "-"
  583.             lblHelp = "Are you pointing at a black line?"
  584.         Case Else
  585.             lblHelp = "No help available..."
  586.     End Select
  587. End Sub
  588.  
  589. Sub InFocus1_MouseOver (ctlName As String, CtlIndex As Integer, CtlTag As String, CtlHwnd As Integer)
  590.     lblEvent = "MouseOver"
  591.     lblControl = ctlName
  592.     Select Case CtlHwnd
  593.         Case btnAdd.hWnd, btnDelete.hWnd, btnSave.hWnd, btnLocate.hWnd
  594.             lblHelp = CtlTag
  595.         Case Else
  596.             lblHelp = ctlFocus.Tag
  597.     End Select
  598. End Sub
  599.  
  600. Sub mnuFileExit_Click ()
  601.     Unload Me
  602. End Sub
  603.  
  604. Sub mnuHelpContents_Click ()
  605.     Dim ret As Integer
  606.     ret = WinHelp(Me.hWnd, App.Path & IIf(Right(App.Path, 1) = "\", "", "\") & "INFOCUS.HLP", 3, 0)
  607. End Sub
  608.  
  609. Sub mnuHelpHelp_Click ()
  610.     Dim ret As Integer
  611.     ret = WinHelp(Me.hWnd, App.Path & IIf(Right(App.Path, 1) = "\", "", "\") & "INFOCUS.HLP", 4, 0)
  612. End Sub
  613.  
  614. Sub mnuHelpSearch_Click ()
  615.     Dim ret As Integer, lpNullStr As Long
  616.     ret = WinHelp(Me.hWnd, App.Path & IIf(Right(App.Path, 1) = "\", "", "\") & "INFOCUS.HLP", 261, lpNullStr)
  617. End Sub
  618.  
  619. Sub picButtonBar_GotFocus ()
  620.     ctlFocus.SetFocus
  621. End Sub
  622.  
  623. Sub picEventInfo_GotFocus ()
  624.     ctlFocus.SetFocus
  625. End Sub
  626.  
  627. Sub picHelp_GotFocus ()
  628.     ctlFocus.SetFocus
  629. End Sub
  630.  
  631. Function StripTabs (arg As String)
  632.     Dim ret As String
  633.     Dim pos As Integer
  634.     ret = arg
  635.     pos = InStr(ret, Chr(9))
  636.     While pos > 0
  637.          Mid(ret, pos, 1) = " "
  638.          pos = InStr(ret, Chr(9))
  639.     Wend
  640.     StripTabs = ret
  641. End Function
  642.  
  643.