Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-08

Getting keyboard input

5 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Dave Coventry

I have a TImage object and a TMemo object on a form and I need to get keyboard presses and display the text into the TMemo.

If a user clicks on the TImage, then the TMemo loses focus and anything typed is lost.

How can this be resolved?

Reply by email

Guionardo Furlan
to Dave Coventry
Dave Coventry wrote 13 lines
I have a TImage object and a TMemo object on a form and I need to get keyboard presses and display the text into the TMemo. If a user clicks on the TImage, then the TMemo loses focus and anything typed is lost. How can this be resolved? -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Have you used the Form's OnKeyPress/OnKeyDown/OnKeyUp events?

Att /Guionardo Furlan/ Timeo hominen unius libri http://guionardofurlan.com.br -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100809/faf7da39/attachment.html>

Reply by email

Dave Coventry
to Guionardo Furlan

Hi Guionardo. Thanks for the response.

2010/8/9 Guionardo Furlan :

Have you used the Form's OnKeyPress/OnKeyDown/OnKeyUp events?

Yes.

procedure TForm1.FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
var ch: char;
begin
  ch:=char(key and $F);
  showmessage('Key='+ch); //<---showmessage not called
end;

As far as I can tell, the FormKeyUp is never called.

I have the TImage and the TMemo just about covering up most of the Form1 area, but have called Form1.SetFocus.

Dave

Reply by email

Bogusław Brandys
to Dave Coventry

Dave Coventry pisze:

Show quoted text 22 lines
Hi Guionardo. Thanks for the response. 2010/8/9 Guionardo Furlan : > Have you used the Form's OnKeyPress/OnKeyDown/OnKeyUp events? Yes. procedure TForm1.FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); var ch: char; begin ch:=char(key and $F); showmessage('Key='+ch); //<---showmessage not called end; As far as I can tell, the FormKeyUp is never called. I have the TImage and the TMemo just about covering up most of the Form1 area, but have called Form1.SetFocus. Dave
Set Form.KEyPreview := true;

Reply by email