Solved

Using CTRL+S to save

Posted on 1997-11-11
11
299 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
Comment Utility
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
Comment Utility
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
Comment Utility
Note, if all the "guts" are taken out and just the capturing occurs, it still beeps.
Max
0
 
LVL 3

Expert Comment

by:Pegasus100397
Comment Utility
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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:maxb
Comment Utility
Update: If the capturing doesnt occur, it still beeps!
0
 

Author Comment

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

Expert Comment

by:andrewjb
Comment Utility
... 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

771 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

14 Experts available now in Live!

Get 1:1 Help Now