Hi,
if you go to the form events in design mode, then you should see an
OnKeyDown event. Click on the "..." button and the event handler will
be defined as the standard FormKeyDown method.
there's a mistake in the code I suggested to you yesterday: key is
declared as a "var" parameter so the correct code is:
var k: word;
begin
...
k:= 65; { this is ASCII character A}
self.FormKeyDown(self,k,[ssAlt]);
...
end;
cheers,
R#
2008/1/16, Fabio Dell'Aria <[EMAIL PROTECTED]>:
> Hi,
>
> 2008/1/15, Roberto Padovani <[EMAIL PROTECTED]>:
> > why don't you call the method FormKeyDown yourself?
> > ...
> > begin
> > ...
> > self.FormKeyDown(self, 65,[ssAlt]);
> > ....
> > end;
>
> I do not find this method.
>
> > R#
> >
> >
> > 2008/1/15, Fabio Dell'Aria <[EMAIL PROTECTED]>:
> > > Hi,
> > >
> > > 2008/1/15, Lee Jenkins <[EMAIL PROTECTED] >:
> > > > Fabio Dell'Aria wrote:
> > > > > Hi to all,
> > > > >
> > > > > how I can simulate the "ALT+E" key-press command on a specified
> TForm
> > > > > for open its "&Edit" menu?
> > > > >
> > > >
> > > > Fabio, can you try:
> > > >
> > > > 1. Set TMyForm.KeyPreview := true
> > > >
> > > > 2. OnKeyDown Event Code:
> > > >
> > > > procedure TMyForm.FormKeyDown ( Sender: TObject; var Key: Word;
> > > > Shift: TShiftState) ;
> > > > begin
> > > > if (ssAlt in Shift) and (key = 65) then
> > > > AMenuItem.Click;
> > > >
> > > > // or...
> > > > // if (ssAlt in Shift) and (lowercase(Chr(key)) = 'e') then
> > > > end;
> > > >
> > > > I don't do that kind of key capture much so there may be a better way
> to
> > > test
> > > > for upper or lowercase 'e';
> > >
> > > Not always this keys open a menu, other times do others.
> > >
> > > So I cannot call directly the MenuItem.Click method.
> > >
> > > I need to simply simulate a keypress. How I can do this?
> > >
> > > > --
> > > > Warm Regards,
> > > >
> > > > Lee
> > > >
> > > > "The only thing that kept me out college...was high school."
> > > >
> > > >
> > >
> _________________________________________________________________
> > > > To unsubscribe: mail [EMAIL PROTECTED] with
> > > > "unsubscribe" as the Subject
> > > > archives at
> > > http://www.lazarus.freepascal.org/mailarchives
> > > >
> > >
> > >
> > >
> > > --
> > > Best regards...
> > >
> > > Fabio Dell'Aria.
> >
> >
> _________________________________________________________________
> > To unsubscribe: mail [EMAIL PROTECTED] with
> > "unsubscribe" as the Subject
> > archives at
> http://www.lazarus.freepascal.org/mailarchives
> >
>
>
>
> --
> Best regards...
>
> Fabio Dell'Aria.
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives