Re: Buttons

new topic     » goto parent     » topic index » view thread      » older message » newer message

Hi George,
> ------- Start of forwarded message -------
> From: George Walters <gwalters at sc.rr.com>
> To: EUforum <EUforum at topica.com>
> Reply-To: EUforum at topica.com
> Subject: Re: Buttons
> Date: 2/08/2001 10:47:23 AM
> 
> Irv, and Derick
>     Where is ... onKeyPress[Screen] = 
> routine_id("onKeyPress_Screen")...
> documented? the w32lib_full.ew book says the syntax for onKeyPress is
> like....onKeyPress(keyCode,shift)....which does not work but 
> what you send
> does...am I missing some doc somewhere??
> 

Is it the "[Screen]" part you are inquiring about?

If so, you are correct, this functionality isn't documented in the HTML
file. It is only documented in the source code. I'll fix that up.

However, it is possible to set an event handler for the 'Screen' control.
When you do this, all events of the type specified are trapped regardless of
which actual control initiated the event.

Thus "onKeyPress[Screen] = routine_id(<whatever>)" will cause the <whatever>
routine to fire up for every keypress in the application regardless of which
control had keyboard focus at the time.

This is not the typical way that Windows programming is done and is only
used for special circumstances. Normally you would set up a seperate
keyboard handler for each specific control you were interested in. With the
Screen option, you have to be careful because you might cause unwanted
side-effects.

For example, in your case you want the 'X' key to exit the window. However,
if the user was entering data into an edit box and happened to enter the
word "fox", you could cause the program to exit prematurely. In this case
you might want to test which control had focus and exclude the special 'X'
processing for edit boxes. 

Also, in a related issue, you can get the KeyPress handler to tell Windows
to ignore the key just entered by the user. For example:

   procedure onKeyPress_Screen(integer keycode, integer shifts)
       if find(keycode, "pP") and 
          getControlInfo(getSelf(), CONTROLINFO_type) != EditText then
            PrintInvoice()
            -- Get Windows to ignore this key.
            returnvalue(-1)
       end if
   end procedure



-----------
cheers,
Derek Parnell
Senior Design Engineer
Global Technology Australasia Ltd
dparnell at glotec.com.au

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


confidential information intended solely for the use of the individual or
entity to whom they are addressed. If you are not the intended recipient of
this message you are hereby notified that any use, dissemination,
distribution or reproduction of this message is prohibited. If you have
received this message in error please notify the sender immediately. Any
views expressed in this message are those of the individual sender and may
not necessarily reflect the views of Global Technology Australasia Limited.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu