Solved

Esc like Shift+Tab

Posted on 2000-04-17
6
270 Views
Last Modified: 2010-04-04
I know how to make Enter act like Tab, but How can I make Esc act like Shift+Tab?
0
Comment
Question by:VSF
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 17

Expert Comment

by:inthe
ID: 2724000
hi,
this works ok:
(must also set keypreview to true)

procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
if key = vk_escape then
 begin
  keybd_Event(VK_SHIFT, 0, 0, 0);
  keybd_Event(VK_TAB, 0, 0, 0);
  keybd_Event(VK_TAB, 0, KEYEVENTF_KEYUP, 0);
  keybd_Event(VK_SHIFT, 0, KEYEVENTF_KEYUP, 0);
 End;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
Form1.Keypreview := True;
end;


Regards Barry
0
 
LVL 3

Author Comment

by:VSF
ID: 2731953
This answer ins't exctely what I want. Cause it's too generic and can generate problems with components like dbgrid.
 To make Enter ack like Tab I use this:
 "perform(wm_nextdlgctl,0,0);"
on the onkeydown Event.
I thought that insted of wm_next I could use wm_prior but it did no work.

So, maybe u know a better way to do it.

Thanks anyway Barry
0
 
LVL 17

Expert Comment

by:inthe
ID: 2732178

you are wanting to send more than one key at a time so there are not exactly a million ways to do it..tab is ok as we have the wm_nextdlgctl message but
?? wm_prior ,you make this up ?i never heard of before nor find any mention in any pas file or api book.

well there is a vk_prior key

keybd_Event(VK_PRIOR, 0, 0, 0);
keybd_Event(VK_PRIOR,0, KEYEVENTF_KEYUP,0);
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Accepted Solution

by:
Ten13 earned 50 total points
ID: 2738890
Hi VSF

Where you use "perform(wm_nextdlgctl,0,0);" to make Enter act like Tab, catch key 27 or VK_ESCAPE and do "perform(wm_nextdlgctl,1,0);"
That will do the trick. The wParam parameter of perform (sendmessage) is the key.

- Martin
0
 
LVL 17

Expert Comment

by:inthe
ID: 2739997
?
0
 
LVL 3

Author Comment

by:VSF
ID: 2743348
That's will work fine thankz!!!!



0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Suggested Courses
Course of the Month9 days, 21 hours left to enroll

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question