Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detect Ctrl + Delete keypress 1

Status
Not open for further replies.

AP81

Programmer
Apr 11, 2003
740
AU
Hi guys,

I have a combobox which I am trying to detect if ctrl + delete is pressed. It seems easy, but I have tried by using the hiword(GetKeyState) function, and tried coding the OnKeyPress/Down procedures with no success.

Any ideas?

Thanks,
Adam




------------------------------------
There's no place like 127.0.0.1
------------------------------------
 
Hi AP81.

Use the object inspector and set the forms Keypreview to TRUE. This will allow the trapping of keystrokes.

Use the forms Onkeydown and insert your code to do what ever you need.

I use...

If (Shift = [ssctrl]) and (inttostr(key) = '107') then
begin // grab ctrl +
If dbscrn.Transdat.state in [dsinsert,dsedit] then dbscrn.Transdat.Post;
if dbscrn.Transdat.flock then
begin
dbscrn.transdat.AppendBlank;
dbscrn.transdat.unlock;
end
else
begin
showmessage('Cannot lock database');
end;
end;

George
 
Thanks it worked. I hadn't set my forms keypreview to TRUE, so my code wasn't working. I used:

Code:
 If (Shift = [ssctrl]) and (key = VK_DELETE) then
  ...

Thanks again.




------------------------------------
There's no place like 127.0.0.1
------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top