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
Solved

Using CTRL+S to save

Posted on 1997-11-11
11
303 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

840 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