1. Win32Lib please fix msg handler

in win32lib:

START CODE QUOTE:
  -- user can process events that Win32Lib doesn't have handlers for.
  if onEvent[ id ] > 0 then
    -- call routine
    call_proc( onEvent[ id ], {iMsg, wParam, lParam} ) --why not a function?

  -- NEW! 0.41 allow user to override
  if myReturn[length(myReturn)] != 0 then
      return popSelf()
  end if
:END CODE QUOTE

The problem is, an event handler often has to return a value of 0 to tell
  Windows it is processing the event.  Since 'popSelf()' only happens
  with non-zero values, its impossible to override without
  modifying the win32lib file.

  How about fixing that in your various versions?
  The simplest is:

  if onEvent[id]>0 then
    retv={0,0}
    retv=call_func(onEvent[id],{iMsg,wParam,lParam})
    if retv[1]>0 then
      return retv[2]
    end if

  If you want to stick with the current method, make each ret stack
  member a two dimensional value:
    {0,0}
  the first value indicating whether or not to return the second value.

  This is a fairly important functionality!

  Thanks,
    Al

new topic     » topic index » view message » categorize

2. Re: Win32Lib please fix msg handler

Ok, it'll go into the next bleeding edge build - I'll work on this today. If
anyone has a better idea to solve this let me know.

---
cheers,
Derek
----- Original Message -----
From: "Al Getz" <xaxo at AOL.COM>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Wednesday, September 06, 2000 6:01 AM
Subject: Win32Lib please fix msg handler


> in win32lib:
>
> START CODE QUOTE:
>   -- user can process events that Win32Lib doesn't have handlers for.
>   if onEvent[ id ] > 0 then
>     -- call routine
>     call_proc( onEvent[ id ], {iMsg, wParam, lParam} ) --why not a
function?
>
>   -- NEW! 0.41 allow user to override
>   if myReturn[length(myReturn)] != 0 then
>       return popSelf()
>   end if
> :END CODE QUOTE
>
> The problem is, an event handler often has to return a value of 0 to tell
>   Windows it is processing the event.  Since 'popSelf()' only happens
>   with non-zero values, its impossible to override without
>   modifying the win32lib file.
>
>   How about fixing that in your various versions?
>   The simplest is:
>
>   if onEvent[id]>0 then
>     retv={0,0}
>     retv=call_func(onEvent[id],{iMsg,wParam,lParam})
>     if retv[1]>0 then
>       return retv[2]
>     end if
>
>   If you want to stick with the current method, make each ret stack
>   member a two dimensional value:
>     {0,0}
>   the first value indicating whether or not to return the second value.
>
>   This is a fairly important functionality!
>
>   Thanks,
>     Al

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

3. Re: Win32Lib please fix msg handler

Al Getz wrote:

<snip>

> The problem is, an event handler often has to return a value
> of 0 to tell
>   Windows it is processing the event.  Since 'popSelf()' only happens
>   with non-zero values, its impossible to override without
>   modifying the win32lib file.
>
>   How about fixing that in your various versions?
>   The simplest is:

<snip>

That's a very good point, although I think I'd change the implementation a
little:

in pushSelf

myReturn &= { {} }


in WndProc/SubProc

object retval
...

if atom(myReturn[length(myReturn)]) then
        return popSelf()
end if
...

There are some other changes that would have to me made, of course, but all
this would be hidden from the user, anyway.

Matt Lewis

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

4. Re: Win32Lib please fix msg handler

Derek Parnell wrote:

> Ok, it'll go into the next bleeding edge build -
> I'll work on this today. If anyone has a better
> idea to solve this let me know.

It would be more clear if there were a wrapper on this:

   skipDefaultProcessing( integer returnCode )

The name isn't very good, feel free to fix it. Other than that, it looks
sensible.

-- David Cuny

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

Search



Quick Links

User menu

Not signed in.

Misc Menu