KeyDown bug (or my ignorance?)

From: Alan Mead (amead_at_comcast.net)
Date: 11/19/04


Date: Fri, 19 Nov 2004 15:38:09 -0600

Sorry, I posted about this earlier using a dumb subject. My code:

procedure TForm1.SearchMemoKeyDown(Sender: TObject;
          var Key: Word; Shift: TShiftState);
begin
{ ShowMessage('You pressed '+IntToStr(Key)+
               ', a='+IntToStr(Ord('a'))+
               'and A='+IntToStr(Ord('A')));
}
  if (((Key=Ord('a')) or (Key=Ord('A'))) and
        (ssCtrl IN Shift)) then
    begin
      SearchMemo.SelectAll;
    end;

end;

The "if.. Selectall" block does not fire if I press Ctrl-a. It will fire
if I press Ctrl-Shift-a.

When I uncomment the ShowMessage, it shows: "You pressed 65, a=97 and
A=65" *regardless* of whether I press 'a' or 'A'.

So, input seems to be upper cased... is there a workaround or am I doing
something wrong?

I'm trying, BTW, to make the Memo select all it's text when the user
presses Ctrl-a (which seems to be a standard Windows shortcut).

-Alan



Relevant Pages

  • Re: server click event on enter press
    ... > that the enter key press on a button does not fire a javascript confirm ... What I have done in the past for this is to use the onsubmit event of the ... That way, whether the user clicks the button or presses enter on it, ... my onsubmit javascript will still run, and then as a bonus I can optionally ...
    (microsoft.public.dotnet.framework.aspnet)
  • button click event
    ... I would like to have an asp.button fire (invoke click event) when the user ... presses the ENTER button on their keyboard. ...
    (microsoft.public.dotnet.framework.aspnet)