Let's say you clicked on the button 'G' on your on screen keyboard and
as described by Glenn you set the text of your active control to
   Edit1.Text := Edit1.Text + ButtonG.Caption (for example) this will fire
the OnChange event of the Edit but not the OnKeyDown or OnKeyPress, and if
you had codes written in those events they wont be executed

    To simulate keyboard events perfectly you need to operate work like the
keyboard. On every button pressed on your on screen keyboard you have to
send a message to the control that a keyboard key was pressed. Try
SendMessage(Edit1.Handle,WM_CHAR,ord('G'),0)

    As for the special keys I'm facing myself a problem as I'm working on a
virtual keyboard right now, if I pass the edit diretly in the SendMessage it
works fine but if I do for example:

vEdit := Screen.ActiveForm.ActiveControl
LaunchKeyBoardForm(vEdit);
// in the keyboard form after pressing a key
SendMessage(vEdit.Handle, WM_CHAR,MapVirtualKey(VK_BACK,2),0) is not working

    Hope this helps
Vahan

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] Behalf
Of Christian Labrie
Sent: Thursday, September 01, 2005 3:19 PM
To: [email protected]
Subject: Re: [delphi-en] Send a keypress message to another component


Thanks for those tips.

Christian
  ----- Original Message -----
  From: Glenn B. Lawler
  To: '[email protected]'
  Sent: Wednesday, August 31, 2005 1:33 PM
  Subject: RE: [delphi-en] Send a keypress message to another component


  > What I want to do is that when I click a button (ex : 5), I want to send
  a message to the form under the modal keypad like if I had pressed '5' in
a
  TEdit.
  > If I press 556.98 ENTER, I want to send evey key to the TEDIT
  (TComponent) under the modal form.

  I have written a number of programs for touchscreen kiosks that display a
  keyboard. It is much simpler to handle this by direct method calls to the
  control(s). If there is more than one, you can use ActiveControl to
  determine
  the control with focus, then use TEdit.SelText to assign the character you
  want to be associated with the button. I set the onclick for all the
  buttons in
  the virtual keyboard to the same handler. If you want more details, let us
  know, but this should get you started. Remember that you will need to
  handle command keys (like the backspace) differently.

  Glenn Lawler



  -----------------------------------------------------
  Home page: http://groups.yahoo.com/group/delphi-en/
  To unsubscribe: [EMAIL PROTECTED]



----------------------------------------------------------------------------
--
  YAHOO! GROUPS LINKS

    a..  Visit your group "delphi-en" on the web.

    b..  To unsubscribe from this group, send an email to:
     [EMAIL PROTECTED]

    c..  Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service.


----------------------------------------------------------------------------
--



[Non-text portions of this message have been removed]



-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED]



----------------------------------------------------------------------------
----
YAHOO! GROUPS LINKS

  a..  Visit your group "delphi-en" on the web.

  b..  To unsubscribe from this group, send an email to:
   [EMAIL PROTECTED]

  c..  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


----------------------------------------------------------------------------
----





[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/i7folB/TM
--------------------------------------------------------------------~-> 

-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED] 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/delphi-en/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to