Hi Glenn
Thanks for your reply, For the moment SendMessage is working fine for
character keys while for function keys I do something like you are doing,
but I do not want to write a special function for each special key, I want
to work the ideal way, which means make this virtual keyboard function like
the user was typing on a real keyboard, in order to fire some events when
needed, for example OnKeyDown or OnKeyUp....
Oh, btw a small remark on your comment, TEdit is not the only control
you can write into, so I check if the active control inherits from
TCustomEdit, which means might be a combo box, a MaskEdits, a DBEdit,
etc.... if it does the keyboard is launched otherwise the user can keep
clicking on the button and nothing will happen.
As for my keyboard keys, I went a little bit further, I designed my own
'key' components that take a different shape while they are pressed or
released, they can be assigned different colors and have double captions and
a key value of course.
for later I want this keyboard to read the current language in windows
and load the key values to the buttons according to this language, just like
windows on-screen keyboard does
Vahan
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] Behalf
Of Glenn B. Lawler
Sent: Tuesday, August 16, 2005 4:59 PM
To: '[email protected]'; Yahoo Groups: Delphi Programmers
Subject: RE: [delphi-en] SendMessage method
Vahan,
> I have designed a virtual keyboard for my application where the user
can
> launch a form anywhere within the application and write into the focused
> control.
>
> I have created my own keyboard buttons and used them on the keyboard
> form. Those components have a property called value. Every time a key is
> pressed I do the following
>
> SendMessage(TheActiveControl.Handle,WM_CHAR,KeyValue,0)
>
> I have the button backspace which key value is initialized like:
> KeyBackspace.KeyValue := VK_BACK
>
> When I click on the backspace key, instead of erasing the last
character
> written I have weird characters written on my controls... any ideas what
am
> I doing wrong here?
I wrote a touchscreen kiosk that did the same kind of thing. A keyboard
made of TSpeedButton components which were all bound to the same
OnClick event handler. I used a more direct approach. Instead of sending
messages to the control, I checked to make sure the ActiveControl was
a TEdit, then did TEdit(ActiveControl).SelText:=Caption (the caption on the
TSpeedButton). This works for the normal keys. For the command keys,
like the backspace, I checked to make sure that SelStart > 0, then did
SelStart:=SelStart-1, then SelLength:=1, then SelText:='';
HTH,
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]
------------------------ Yahoo! Groups Sponsor --------------------~-->
<font face=arial size=-1><a
href="http://us.ard.yahoo.com/SIG=12h2tt1oq/M=362329.6886308.7839368.1510227/D=groups/S=1705115362:TM/Y=YAHOO/EXP=1124268780/A=2894321/R=0/SIG=11dvsfulr/*http://youthnoise.com/page.php?page_id=1992
">Fair play? Video games influencing politics. Click and talk back!</a>.</font>
--------------------------------------------------------------------~->
-----------------------------------------------------
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/