home *** CD-ROM | disk | FTP | other *** search
- Type KeyboardMasterForm From SampleMasterForm
- Dim Label1 As New Label
- Dim txtKeyboardEntry As New TextBox
- Dim lstKeyboard As New ListBox
- Dim btnClear As New Button
- Dim chkAutoClear As New CheckBox
-
- ' METHODS for object: KeyboardMasterForm
- Sub btnClear_Click()
- lstKeyboard.Clear
- txtKeyboardEntry.SetFocus
- End Sub
-
- Sub chkAutoClear_Click()
- If chkAutoClear.Value = 0 Then
- btnClear.Enabled = "True"
- Else
- btnClear.Enabled = "False"
- End If
-
- txtKeyboardEntry.SetFocus
- End Sub
-
- Sub ResetApplication_Click ()
-
- txtKeyboardEntry.Text = ""
- lstKeyboard.Clear
- txtKeyboardEntry.SetFocus
-
- chkAutoClear.Value = 0
- txtKeyboardEntry.Enabled = "True"
-
- End Sub
-
- Sub txtKeyboardEntry_KeyDown(keyCode As Integer, ByVal shift As Integer)
- Dim action As String
-
- action = "KeyDown - keyCode is: " & keyCode & " Shift parameter is: " & shift
- lstKeyboard.AddItem action
-
- ' Check to see if the autoclear is on
- If chkAutoClear.Value = 1 Then
- If lstKeyboard.ListCount > 18 Then
- lstKeyboard.Clear
- End If
- End If
-
- End Sub
-
- Sub txtKeyboardEntry_KeyPress(keyAscii As Integer)
- Dim action As String
-
- action = "KeyPress - keyAscii is: " & keyAscii & " Character is: [" & Chr(keyAscii) & "]"
- lstKeyboard.AddItem action
-
- ' Don't allow anything to come into the box
- keyAscii = 0
-
- End Sub
-
- Sub txtKeyboardEntry_KeyUp(keyCode As Integer, ByVal shift As Integer)
- Dim action As String
- Dim entry As String
-
- action = "KeyUp - keyCode is: " & keyCode & " Shift parameter is: " & shift
- lstKeyboard.AddItem action
-
- ' Check to see if the autoclear is on
- If chkAutoClear.Value = 1 Then
- If lstKeyboard.ListCount > 18 Then
- ' Get the last entry, clear list and add the entry to first row
- entry = lstKeyboard.List(lstKeyboard.ListCount - 1)
- lstKeyboard.Clear
- lstKeyboard.AddItem(entry)
- End If
- End If
-
- End Sub
-
- End Type
-
- Begin Code
- ' Reconstruction commands for object: KeyboardMasterForm
- '
- With KeyboardMasterForm
- .Caption := "Keyboard KeyPress Demonstration"
- .Move(2430, 1950, 7785, 6675)
- .SampleDir := "C:\envelop\bootcamp\basic\keyboard\"
- .SampleName := "keyboard"
- With .Label1
- .Caption := "Type in the box at right to see keyboard events in the list below:"
- .ForeColor := 13107200
- .ZOrder := 1
- .Move(315, 225, 6300, 300)
- End With 'KeyboardMasterForm.Label1
- With .txtKeyboardEntry
- .ZOrder := 2
- .Move(6750, 180, 600, 360)
- End With 'KeyboardMasterForm.txtKeyboardEntry
- With .lstKeyboard
- .ZOrder := 3
- .Move(255, 630, 7170, 4350)
- .Sorted := False
- End With 'KeyboardMasterForm.lstKeyboard
- With .btnClear
- .Caption := "Manual Clear"
- .ZOrder := 4
- .Move(450, 5250, 1650, 450)
- End With 'KeyboardMasterForm.btnClear
- With .chkAutoClear
- .Caption := "Automatic Clear"
- .ZOrder := 5
- .Move(2550, 5310, 1950, 300)
- End With 'KeyboardMasterForm.chkAutoClear
- With .helpfile
- .FileName := "C:\envelop\bootcamp\basic\keyboard\keyboard.hlp"
- End With 'KeyboardMasterForm.helpfile
- End With 'KeyboardMasterForm
- End Code
-