Vahan,
I don't do: Edit1.Text:=Edit1.Text+ButtonG.Caption
I do this: Edit1.SelText:=ButtonG.Caption
I have not tested which events are fired with the method I use.
One thing I would mention is that I would consider it an _advantage_
to use an approach which does not perfectly emulate pressing a key.
The reason is that it is much easier to tell the difference between input
coming from the virtual keyboard and input coming from the real
keyboard. Remember, if you want the events you mentioned to be
fired when the virtual keyboard sends data, you can always call them
explicitly from the OnClick event of the button.
Glenn Lawler
On Thursday, September 01, 2005 9:36 AM, Vahan Yoghoudjian [SMTP:[EMAIL
PROTECTED] wrote:
> 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]
>
>
>
>
> -----------------------------------------------------
> Home page: http://groups.yahoo.com/group/delphi-en/
> To unsubscribe: [EMAIL PROTECTED]
> Yahoo! Groups Links
>
>
>
>
>
>
------------------------ Yahoo! Groups Sponsor --------------------~-->
Most low income households are not online. Help bridge the digital divide today!
http://us.click.yahoo.com/cd_AJB/QnQLAA/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/