user2175495
user2175495

Reputation:

Disable the "Chime" sound with Ctrl-F in a Memo

I am using a TReplaceDialog and the following to catch key to launch the dialog, but Windows 8.1 keeps going "Ding" when I use it. How can I stop that chime? I have tried messing with the Form KeyPreview but still get that chime. Same for using the ShortCut (Ctrl-R) with the Popup menu Item "pupuFindReplaceText"

Also, I get the chime when I use the Tab to move from the "Find text" edit to the "Replace text" Edit within the dialog. Or, is this just a feature of 8.1?

if Shift = [ssCtrl] then
begin
  if Char(Key) in ['F','f','R','r'] then
    puFindReplaceTextClick(Sender);
  Key:=0;
end else
begin
end;

Upvotes: 0

Views: 974

Answers (1)

Andreas Rejbrand
Andreas Rejbrand

Reputation: 108963

Instead of using OnKeyDown, use OnKeyPress:

procedure TForm1.Memo1KeyPress(Sender: TObject; var Key: Char);
begin
  if Key = ^F then
  begin
    // Do something;
    Key := #0;
  end;
end;

Upvotes: 2

Related Questions