Solved

Using CTRL+S to save

Posted on 1997-11-11
11
300 Views
Last Modified: 2010-04-04
I'm trying to use CTRL+S to save (capturing the key press in OnKeyDown) and it works fine, except that it beeps. I'm setting the key parameter to 0, but that hasn't stopped the beep.
0
Comment
Question by:maxb
11 Comments
 
LVL 3

Expert Comment

by:Pegasus100397
ID: 1349973
Max... Strange! I've just made a form and handled the Ctrl-S without any beeps in the OnKeyDown event!

My guess is that you are calling the Beep command someplace maybe? Ctrl-S should not cause and "default" window beeps.

Can ya post the section of code so we can have a look?

Good luck with your project!
Pegasus


0
 

Author Comment

by:maxb
ID: 1349974
Heres the code:
 
  if ((ssCtrl in Shift) and (Chr(Key) = 'S')) then begin
     Key := 0;
     PostChanges;
     NewRecord;
     edtCategory.SetFocus;
     Key := 0;
  end;

Max
0
 

Author Comment

by:maxb
ID: 1349975
Note, if all the "guts" are taken out and just the capturing occurs, it still beeps.
Max
0
 
LVL 3

Expert Comment

by:Pegasus100397
ID: 1349976
Start a new project, one form and put the following in the forms OnKeyDown even and let me know what happens:

If ((ssCtrl in Shift) and (Chr(Key) = 'S')) then
   Form1.Caption := 'Ctrl-S PRESSED'
else
   begin
   Form1.Caption := 'some other key pressed';
   end;
key := 0;

0
 

Author Comment

by:maxb
ID: 1349977
Wow...hmm. It didnt beep on a new project yet it beeped in the old one when I substituted the code. Showing there is something on the form which is catching the ctrl+s as well and making the beep. The bad part is..I have no clue on what else is catching it since there are no shortcuts on the form (the underlilned letters in a word) and no menus that could have shortcuts...any ideas?
Max
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.

 

Author Comment

by:maxb
ID: 1349978
Update: If the capturing doesnt occur, it still beeps!
0
 

Author Comment

by:maxb
ID: 1349979
Update: If the capturing doesnt occur, it still beeps!
Agh
0
 
LVL 12

Expert Comment

by:andrewjb
ID: 1349980
... hence it's nothing to do with catching the key at all, but ( for example ) your edtCategory editbox has an 'OnEnter' method that beeps.
0
 
LVL 5

Expert Comment

by:JimBob091197
ID: 1349981
What control has the focus when you trap the keystroke?  It is most likely the ActiveControl that is beeping, not the form.

JB
0
 
LVL 3

Accepted Solution

by:
Pegasus100397 earned 50 total points
ID: 1349982
Max,

Search THAT particular unit for the word BEEP and comment them all out and see what happens. If it's not there, then look in your Table or Datasource events for anything that might beep during data validation, New record, etc.

Next option would be to go one by one and CUT the controls off a form (onto the clipboard) and test again. If it still beeps, PASTE the control back and move on to the next one.

Of course, you could also do a Global search on the entire project and find a Beep statement in some obscure procedure someplace else. Keep us updated! :^)

Pegasus
0
 

Author Comment

by:maxb
ID: 1349983
Thanks,
It turns out that the form was also katching keys and not setting the key to 0 that made it beep.
Max
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
Correct Component for Shopping Cart. 2 95
find a node in VST 2 63
control image tags in a string ? 12 110
Delphi: Connect to running MS Outlook 4 47
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…
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…
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…
Send secure, cloud-based, encrypted alerts and maintain HIPAA compliant messaging. Integrates priority & secure messaging into one application. Ensures IT, emergency respondents and healthcare professionals that their critical messages are never mis…

911 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

22 Experts available now in Live!

Get 1:1 Help Now