Vahan,

>     Not that I'm judging your method but can you give me an example where
> you'd want to differentiate inputs from the physical keyboard and those from
> the virtual keyboard?

With touchscreen Kiosks it is common to create special virtual keys that
are not a one-for-one mapping to a real keyboard key. For example, you
may want a key labeled "Log in". With the approach I use, this kind of thing
is straightforward since there is no attempt to bind the program logic
directly to the controls or their events.

I have found that programs written in standard languages, like Pascal, are
realtively easy to port to entirely different environments when all the logic
is isolated to internal scalars and structures that are standard to the
language. I tend to isolate all of the program I/O to very simple event
handlers that assign the internal values and / or call functions or procedures
to implement the program behavior. These functions and procedures know
nothing about where the input came from and nothing about how the output
is presented to the user. When you write software in this way, the difficult
part of the program remains in the standard language and therefore does
not need to be ported at all. The only part of the program you need to port
is the I/O, and if it is kept very simple, porting that code is quick, easy, and
not likely to introduce bugs.

You may be wondering, "when would I ever need to do a port of my code
like that". We do it regularly as we move applications we have written to the
internet. Building an internet-based application is an entirely different
environment without any of the event-handlers common to a desktop
environment, unless you are using something like .NET. We avoid using
.NET or anything else that is not standards based.

Glenn Lawler

On Friday, September 02, 2005 1:57 AM, Vahan Yoghoudjian [SMTP:[EMAIL 
PROTECTED] wrote:
>     Good morning Glenn
> 
>     Well it all depends on your method of work... in my case it doesn't
> matter if those keys were fired from the physical or virtual keyboard. The
> virtual keyboard I have designed works (and should work) on every control
> inheriting from TCustomEdit and it can be launched anywhere in the
> application.
>     For some controls I have codes written in the OnKeyDown, OnKeyPress and
> OnKeyUp events to control the data input or the text formatting in the
> control. From one control to another those codes differ, so I simulate key
> events as if keys were pressed from the physical keyboard itself.
>     Not that I'm judging your method but can you give me an example where
> you'd want to differentiate inputs from the physical keyboard and those from
> the virtual keyboard?
> 
> N.B.- When I first designed a small numerical pad I was using your method
> but now that I have enhanced this pad to be a complete keyboard (which will
> also read key values according to the language selected in windows) I
> switched to win messages
> 
> Thanks
> Vahan
> 
> -----Original Message-----
> From: [email protected] [mailto:[EMAIL PROTECTED] Behalf
> Of Glenn B. Lawler
> Sent: Thursday, September 01, 2005 6:13 PM
> To: '[email protected]'
> Subject: RE: [delphi-en] Send a keypress message to another component
> 
> 
> 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
> >
> >
> >
> >
> >
> >
> 
> 
> -----------------------------------------------------
> Home page: http://groups.yahoo.com/group/delphi-en/
> To unsubscribe: [EMAIL PROTECTED]
> 
> 
> 
> SPONSORED LINKS Basic programming language  C programming language  Computer
> programming languages
>       The c programming language  C programming language  List of
> programming languages
> 
> 
> ----------------------------------------------------------------------------
> ----
> 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/
 


Reply via email to