Solved

Using CTRL+S to save

Posted on 1997-11-11
11
301 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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Copy file in dll not working but working on exe ! 18 92
Internet Explorer View Settings Question 15 111
control image tags in a string ? 12 129
Firemonkey allowing RTL on android 6 29
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

806 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