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

Edit Box does not handle KeyPress Event()

Status
Not open for further replies.

shahatul

Programmer
May 28, 2002
23
US
The users hit the Alt+Z keys for zooming Edit box. The KeyPress Event() does not give me Alt+Z keys values. What am I missing, guys?

Thanks
 
you're right, ALT+Z doesn't seem to work with Keypress (ALT+Anyhting doesn't work). Probably because it is needed for access keys or something.

Instead in the gotfocus event...

ON KEY label ALT+Z Messagebox("User Pressed ALT+Z")

...in the lostfocus event...

ON KEY label ALT+Z

...now the messagebox() function above is just to show that it can be done...you will need to replace it with a function that will do your zooming functionality.

Slighthaze = NULL

[ul][li]FAQ184-2483
An excellent guide to getting a fast and accurate response to your questions in this forum.[/li][/ul]
 
HI

Any ALT+ combination will not be recognised in KeyPress Events of any control. This is because, the system menus are associated with Alt and also Windows behaviour of pressing Alt takes precedence.

Instead use Ctrl+Z and trap it in the KeyPressEvent.

:)

ramani :)
(Subramanian.G)
 
As a general recommendation: try to avoid using Alt+<letter> keystroke combination for your own purposes. Almost all of these combinations are reserved as shortcut key sequences by OS or VFP itself, i.e. Alt+F, Alt+W, Alt+Z, etc. I found it out the hard way.

I'd suggest using Alt+Shift+<letter> instead, or Ctrl+<letter> (the later also can be dangerous, think of Ctrl+F, Ctrl+C, Ctrl+V, etc.)

ON KEY LABEL Alt+<letter> is one way to bypass system defined key sequence. Just don't forget PUSH KEY before redefining, and POP KEY after you've done with your routine, and most of all - ON KEY LABEL on exiting your program.


Regards,

Ilya
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top