Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Jump from one control to another

Status
Not open for further replies.

alisaif

ISP
Apr 6, 2013
418
AE
Hi,

In data entry form, I want users can not loose control if they are using backspace, arrow keys only the can move by using <Enter>, <Tab> or <Shift+Tab>.

Thanks

Saif
 
Look at this discussions:

thread184-1003361
thread184-512280
thread184-124396
thread184-236981

In short: I wouldn't change the arrow key behaviour. Users should learn to use End or Pos1/Home to position on the start or end of a textbox instead of holding down left/right arrow key and wait, and to delete the whole box, use CTRL+A, then DEL (once) and that's even just one DEL or backspace, if you set SelectOnEntry = .T.

So even in regard to backspace I disagree, it's the users, who are doing this wrong. Users holding down keys and then complaining about what happens are more of a nuisance, because they should know better.

If you still want to go for that, you can take the keypress solutions and not only catch keycode 127 for backspace, but also arrow key codes, and you can make the suppression depend on textbox.SelStart being 0 (pos1) or this.value.length (end) and also cause the bell sound via ? chr(7) in case this keypress happens at these positions.

I wouldn't go for any of the solutions in the valid event, because the usage of the textbox can be key input and mouse and checking lastkey() even in conjunction with the cursor position in Selstart can give wrong results here. In keypress you know it's the actual key press right now.

Bye, Olaf.
 
Thanks nice information related to the topic.

Saif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top