Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: SQL
Expertise: Beginner
Mar 24, 1997

OnKey()

Question:
What is the OnKey() method?

Answer:
The OnKey() method is a new method introduced with OPO version 1.0.16. The OnKey() method is triggered for an object whenever a user enters a keystroke into the object at run-time.

The OnKey() method has three parameters: the keychar parameter, the keycode parameter and the shift parameter. The keychar, as the name implies, is the keystroke entered by the user. The keycode is a constant that indicates the type of keystroke entered - such as KEYCODE_CHAR for any alphanumeric or punctuation character, KEYCODE_DELETE for the delete key, etc. The shift parameter indicates whether the Shift or Control keys were pressed with the keystroke.

If you return True from the OnKey() method, you prevent the default processing of the keystoke, which includes setting the Value of the object. If you return nothing or False, the default keystroke processing does take place.

You can use the OnKey() method for a wide variety of purposes, such as monitoring user entries, bringing up other forms that contain context sensitive information or intercepting and replacing keystokes entered.

Version 1.0.16 of Power Objects also has a ChildOnKey() method, which works at the container level.

You can see an example of the OnKey() method at work if you look at the question on hiding passwords elsewhere in this area.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date