1. [WIN] trapping a key press for an SLE

How do I trap a keypress for an SLE? Trying to test for ENTER, but it doesn't
seem to
work..

Chris

________________________________________________________________

new topic     » topic index » view message » categorize

2. Re: [WIN] trapping a key press for an SLE

----- Original Message -----
From: "chris bensler" <bensler at Mailops.Com>

> How do I trap a keypress for an SLE? Trying to test for ENTER, but it
doesn't seem to
> work..

Here is a sample program for you to use....

  include win32lib.ew
  without warning
  constant win = create(Window, "Test", 0, 0, 0, 400, 400, 0),
           SB  = create(StatusBar, "", win , 0, 0 ,0, 0, 0),
           sle = create(EditText, "", win, 5, 5, 300, 25, 0)

  procedure xx(integer self, integer event, sequence parms)
      -- parms[1] is the keycode (13 = Return Key)
      -- parms[2] is the Shift key status.
      setText(SB, sprintf("%d %d %d %d", {self, event, parms[1], parms[2]}))
  end procedure
  setHandler(sle, w32HKeyPress, routine_id("xx"))

  WinMain(win,0)

------
Derek Parnell
Melbourne, Australia
(Vote [1] The Cheshire Cat for Internet Mascot)

new topic     » goto parent     » topic index » view message » categorize

3. Re: [WIN] trapping a key press for an SLE

TY,

  Is that in the docs? Why doesn't onKeyDown work? I read somewheres in the docs
that editText won't trap , keyPresses, but WILL trap keyDown events.. is that
true?


Chris


---------- Original Message ----------------------------------
From:         Derek Parnell <dparnell at BIGPOND.NET.AU>
Date:         Sun, 21 Jan 2001 13:22:11 +1100

>----- Original Message -----
>From: "chris bensler" <bensler at Mailops.Com>
>
>> How do I trap a keypress for an SLE? Trying to test for ENTER, but it
>doesn't seem to
>> work..
>
>Here is a sample program for you to use....
>
>  include win32lib.ew
>  without warning
>  constant win = create(Window, "Test", 0, 0, 0, 400, 400, 0),
>           SB  = create(StatusBar, "", win , 0, 0 ,0, 0, 0),
>           sle = create(EditText, "", win, 5, 5, 300, 25, 0)
>
>  procedure xx(integer self, integer event, sequence parms)
>      -- parms[1] is the keycode (13 = Return Key)
>      -- parms[2] is the Shift key status.
>      setText(SB, sprintf("%d %d %d %d", {self, event, parms[1], parms[2]}))
>  end procedure
>  setHandler(sle, w32HKeyPress, routine_id("xx"))
>
>  WinMain(win,0)
>
>------
>Derek Parnell
>Melbourne, Australia
>(Vote [1] The Cheshire Cat for Internet Mascot)
>


________________________________________________________________

new topic     » goto parent     » topic index » view message » categorize

4. Re: [WIN] trapping a key press for an SLE

If you intend to trap all keystrokes, i think you'll have to
subclass the edit control.  You can pass events you dont
want to trap, while processing whatever you wish.

Good luck with it,
Al

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu