Sign in Join

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

Mailing lists / lazarus / 2008-03

Send keys to visual component

4 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

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

Denis Golovan

Hi, all

I have problems with sending (emulation) keypresses to visual controls under Lazarus. Final solution must work under wince :). Hope Lazarus will help.

I try as wiki states:

  var K:TUTF8Char;
  ...
  K:=IntToStr(1); //simplified example
  grdBusket.IntfUtf8KeyPress( K, 1, false ); //sending key to grid control
  ...
  but with no luck.
  Help, guru :)
Best regards, Denis Golovan aka MageSlayer

Reply by email

Mattias Gaertner
to Denis Golovan
Show quoted text 15 lines
Hi, all I have problems with sending (emulation) keypresses to visual controls under Lazarus. Final solution must work under wince :). Hope Lazarus will help. I try as wiki states: var K:TUTF8Char; ... K:=IntToStr(1); //simplified example grdBusket.IntfUtf8KeyPress( K, 1, false ); //sending key to grid control ... but with no luck.

TControl.Intf* functions should only be used by the LCL interfaces.

Maybe if you explain what effect you want to achieve, some windows/wince devel can help.

Mattias

Reply by email

Felipe Monteiro de Carvalho
to Denis Golovan: Hi, all I have problems with sending (emulation) keypresses to visual controls under…

IntfUtf8KeyPress will tell LCL that your control received a keypress message, and thus it will call your OnUTF8KeyPress handler, but it won't really emulate a key press on the control.

To do that I would try using SendMessageW to send a WM_CHAR (or some other message) to the control. docs here:

http://www.google.com.br/search?hl=pt-BR&q=site%3Amsdn2.microsoft.com+sendmessage&btnG=Pesquisa+Google&meta=

We have a partial implementation of SendMessage on LCLIntf, but I would bet it isn't capable of emulating key pressing everywhere.

The Windows version of SendMessage obviously only works for Windows and Windows CE.

Felipe Monteiro de Carvalho

Reply by email

Graeme Geldenhuys
to Denis Golovan: Hi, all I have problems with sending (emulation) keypresses to visual controls under…
Denis Golovan wrote
I have problems with sending (emulation) keypresses to visual controls under Lazarus. Final solution must work under wince :). Hope Lazarus will help.

Just curious... Other that writing a Virtual Keyboard application, what would you used 'emulating' keypresses for? Can't you simply call the appropriate method of the Grid?

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email