Solved

Esc like Shift+Tab

Posted on 2000-04-17
6
266 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

813 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

19 Experts available now in Live!

Get 1:1 Help Now