![]() |
![]() |
| Site sponsored by virtual-keyboard.com |
|
|
Minimize a keyboard using a timer and scriptingMinimizing a keyboard after a certain length of time with no keyboard input is very simple using a script procedure.The script necessary for minimizing the keyboard is as follows: Dim TimeCounter Sub LogKeyPress (Sender) ' This procedure needs to be linked to every key on your ' keyboard (excluding the minimize key if you have one). TimeCounter = 0 End Sub Sub KeyboardTimer (Sender) TimeCounter = TimeCounter+1 If TimeCounter >= 10 Then ' This can be set to any length of time you choose (in seconds). kbd.Keyboard.PageControl1.Min.Activate ' This needs to be modified if you have re-named PageControl1 or your Minimized page. End If End Sub Sub MinActivate (Sender) kbd.Keyboard.TimerEnabled = False TimeCounter = 0 End Sub Sub MinDeactivate (Sender) kbd.Keyboard.TimerEnabled = True End Sub Keep in mind, that all the keys on your keyboard will need to be linked to the LogKeyPress in the OnKeyPressed event. To do this (with the exception of the Minimize key and the Close key (if you have one)) begin by selecting all the keys on the keyboard, clicking on the Events tab, clicking to the right of the OnKeyPressed event and choosing LogKeyPress from the drop down list and pressing enter. Now you will need to link the minimized page to 2 events in the script. Choose the minimized page from the list of objects and click to select it and you will see a list of events for this page. Click on the drop down arrow to the right of OnActivate and choose MinActivate from the list and press Enter. Next click on the drop down list to the right of OnDeactivate and choose MinDeactivate from the list and press Enter. The last thing you need to do is enable the timer on the keyboard. Choose the keyboard object from the list of objects and click on the Properties tab. Near the bottom of the list of properties, set the TimerEnabled property to True and the TimerInterval to 1000 (or any other interval you like). Next you will need to link the keyboard object to the KeyboardTimer procedure by clicking on the Events tab, clicking to the right of the OnTimer event and choosing KeyboardTimer from the drop down list and pressing enter. If you would like to download the keyboard file that was created in this article, click here. Add or view comments (0) to this article. Click here for printable version. |
||||||||||||
| © 2002 - 2009 MountFocus Information Systems |