home *** CD-ROM | disk | FTP | other *** search
/ The Best of Select: Windows 95 Special 2 / WIN95_2.bin / utils / envelop / envelop.6 / Tools / Bootcamp / basic / keyboard / keyboard.eto < prev    next >
Encoding:
Text File  |  1996-07-08  |  3.3 KB  |  120 lines

  1. Type KeyboardMasterForm From SampleMasterForm
  2.   Dim Label1 As New Label
  3.   Dim txtKeyboardEntry As New TextBox
  4.   Dim lstKeyboard As New ListBox
  5.   Dim btnClear As New Button
  6.   Dim chkAutoClear As New CheckBox
  7.  
  8.   ' METHODS for object: KeyboardMasterForm
  9.   Sub btnClear_Click()
  10.     lstKeyboard.Clear
  11.     txtKeyboardEntry.SetFocus
  12.   End Sub
  13.  
  14.   Sub chkAutoClear_Click()
  15.     If chkAutoClear.Value = 0 Then 
  16.       btnClear.Enabled = "True"
  17.     Else 
  18.       btnClear.Enabled = "False"
  19.     End If
  20.   
  21.     txtKeyboardEntry.SetFocus
  22.   End Sub
  23.  
  24.   Sub ResetApplication_Click ()
  25.   
  26.     txtKeyboardEntry.Text = ""
  27.     lstKeyboard.Clear
  28.     txtKeyboardEntry.SetFocus
  29.   
  30.     chkAutoClear.Value = 0
  31.     txtKeyboardEntry.Enabled = "True"
  32.   
  33.   End Sub
  34.  
  35.   Sub txtKeyboardEntry_KeyDown(keyCode As Integer, ByVal shift As Integer)
  36.     Dim action As String
  37.   
  38.     action = "KeyDown - keyCode is: " & keyCode & " Shift parameter is: " & shift
  39.     lstKeyboard.AddItem action
  40.   
  41.     ' Check to see if the autoclear is on
  42.     If chkAutoClear.Value = 1 Then 
  43.       If lstKeyboard.ListCount > 18 Then 
  44.         lstKeyboard.Clear
  45.       End If
  46.     End If
  47.   
  48.   End Sub
  49.  
  50.   Sub txtKeyboardEntry_KeyPress(keyAscii As Integer)
  51.     Dim action As String
  52.   
  53.     action = "KeyPress - keyAscii is: " & keyAscii & " Character is: [" & Chr(keyAscii) & "]"
  54.     lstKeyboard.AddItem action
  55.   
  56.     ' Don't allow anything to come into the box
  57.     keyAscii = 0
  58.   
  59.   End Sub
  60.  
  61.   Sub txtKeyboardEntry_KeyUp(keyCode As Integer, ByVal shift As Integer)
  62.     Dim action As String
  63.     Dim entry As String
  64.   
  65.     action = "KeyUp - keyCode is: " & keyCode & " Shift parameter is: " & shift
  66.     lstKeyboard.AddItem action
  67.   
  68.     ' Check to see if the autoclear is on
  69.     If chkAutoClear.Value = 1 Then 
  70.       If lstKeyboard.ListCount > 18 Then 
  71.         ' Get the last entry, clear list and add the entry to first row
  72.         entry = lstKeyboard.List(lstKeyboard.ListCount - 1)
  73.         lstKeyboard.Clear
  74.         lstKeyboard.AddItem(entry)
  75.       End If
  76.     End If
  77.   
  78.   End Sub
  79.  
  80. End Type
  81.  
  82. Begin Code
  83. ' Reconstruction commands for object: KeyboardMasterForm
  84. '
  85.   With KeyboardMasterForm
  86.     .Caption := "Keyboard KeyPress Demonstration"
  87.     .Move(2430, 1950, 7785, 6675)
  88.     .SampleDir := "C:\envelop\bootcamp\basic\keyboard\"
  89.     .SampleName := "keyboard"
  90.     With .Label1
  91.       .Caption := "Type in the box at right to see keyboard events in the list below:"
  92.       .ForeColor := 13107200
  93.       .ZOrder := 1
  94.       .Move(315, 225, 6300, 300)
  95.     End With  'KeyboardMasterForm.Label1
  96.     With .txtKeyboardEntry
  97.       .ZOrder := 2
  98.       .Move(6750, 180, 600, 360)
  99.     End With  'KeyboardMasterForm.txtKeyboardEntry
  100.     With .lstKeyboard
  101.       .ZOrder := 3
  102.       .Move(255, 630, 7170, 4350)
  103.       .Sorted := False
  104.     End With  'KeyboardMasterForm.lstKeyboard
  105.     With .btnClear
  106.       .Caption := "Manual Clear"
  107.       .ZOrder := 4
  108.       .Move(450, 5250, 1650, 450)
  109.     End With  'KeyboardMasterForm.btnClear
  110.     With .chkAutoClear
  111.       .Caption := "Automatic Clear"
  112.       .ZOrder := 5
  113.       .Move(2550, 5310, 1950, 300)
  114.     End With  'KeyboardMasterForm.chkAutoClear
  115.     With .helpfile
  116.       .FileName := "C:\envelop\bootcamp\basic\keyboard\keyboard.hlp"
  117.     End With  'KeyboardMasterForm.helpfile
  118.   End With  'KeyboardMasterForm
  119. End Code
  120.