Solved

Esc like Shift+Tab

Posted on 2000-04-17
6
265 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
  • 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Activex get website that activex running on 3 85
Process Javascript errors with Delphi TWebBrowser 1 113
How to debug For loops? 3 45
Delphi and Access based Enumeration 9 47
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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

920 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now