Solved

Esc like Shift+Tab

Posted on 2000-04-17
6
263 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
Comment Utility
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
Comment Utility
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
Comment Utility

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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 2

Accepted Solution

by:
Ten13 earned 50 total points
Comment Utility
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
Comment Utility
?
0
 
LVL 3

Author Comment

by:VSF
Comment Utility
That's will work fine thankz!!!!



0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

762 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

9 Experts available now in Live!

Get 1:1 Help Now