Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: Visual FoxPro
Expertise: Beginner
Nov 5, 1999



Application Security Testing: An Integral Part of DevOps

Backspaces and Form Focus

I have two questions:
  1. When using the Backspace key to delete content in a text box, the control is passed to the preceding text box once all data is erased. Can this be disabled?
  2. When calling one form from another, the form to be loaded doesn't receive the focus; thus the user has to click on the form first before using the form. How do I correct this?

To prevent loss of focus when pressing Backspace once all data has been erased, put the following code into the KeyPress Event of the textbox:

LPARAMETERS nKeyCode, nShiftAltCtrl

*-- If textbox value is empty and the 
*-- backspace key was pressed, ignore
*-- the key
IF EMPTY(this.Value) AND nKeyCode = 127
Regarding the focus issue, you may want to call the SetFocus() method of the called form to make sure that it receives focus.
DevX Pro
Comment and Contribute






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



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