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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set confirm on with BackSpace & Arrow Keys

Status
Not open for further replies.

mstrcmtr

Programmer
Nov 14, 2007
103
PK
Set confirm on not stop BackSpace & Arrow Keys from textbox control

How can Stop exiting from textbox control only on Enter Key
 
SET CONFIRM ON means enforcing the use of ENTER. You can't have SET CONFIRM ON and not want its restriction. That's nonsense.

SET CONFIRM OFF and you can tab and use arrow keys again.

If you want any more specific behaviour, you have the VALID event and can control when and when not to Return .T., you can enforce staying in the current control by RETURN .F. or RETURN 0, which IIRC differs in either showing or not showing a message of "invalid input", so you can even control that part of the behaviour.

Bye, Olaf.
 
If you want more control over keystrokes in a textbox, use the KeyPress method.
 
Just a sidenote, as you mention Textbox and not Editbox, but due to TAB being a valuable text formatting, the editbox behaviour can be changed via .AllowTabs property.

I also think we had a lengthy thread here about the idea of changing control behaviour via Keypress code. Tamar is right on that, I would not recommend to have too much in there, as it will hardly be maintainable even for yourself one year later.

For example we solved the case to prevent BACKSPACE deleting more than the current textbox in thread184-1654550

Searching for Keypress here in the tek-tips search might find something for whatever your reason to allow some and not other keys.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top