Solved

Using CTRL+S to save

Posted on 1997-11-11
11
310 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

691 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