Solved

Esc like Shift+Tab

Posted on 2000-04-17
6
269 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
Industry Leaders: 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

Industry Leaders: 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

Suggested Solutions

Title # Comments Views Activity
Can Viruses spread while transferring Binary data with Winsock 2 107
Delphi Form ownership 4 160
Multiple image collision 13 109
How to load 2 images in same column in Delphi 2 81
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

751 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