Re: setHandler bug

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

Judith is correct. When using setHandler, the parameters your routine gets
are the ID of the control receiving the event, Win32lib-Event#, and a list
of "real" parameters. The 'event' is NOT the Windows event number, eg.
WM_NOTIFY, but the win32lib event number, eg. w32HEvent.

By having exactly the same parameter signature for all event handlers, we
are able to share code more easily, and having the advantage of future
changes to win32lib not breaking existing event handlers.

-------------
Derek.

----- Original Message -----
From: "Judith" <camping at txcyber.com>
To: "EUforum" <EUforum at topica.com>
Sent: Sunday, June 16, 2002 9:41 PM
Subject: RE: setHandler bug


>
> It's my understanding that when using setHandler that your procedure
> params change to integer self, integer event, sequence params, or
> whatever variable names you choose,
> and that in params you find event, wParam and lParam so that your
> routine would look something like this:
>
> procedure on_event( integer self, integer event, sequence params)
>     if params[1] = WM_NOTIFY then
>         ?1
>     end if
> end procedure
> setHandler(Win, w32HEvent, routine_id("on_event"))
>
>
> tone.skoda at gmx.net wrote:
> > Hi,
> > It looks like event parameter in on_event () is allways 3 when using
> > setHandler().
> >
> > Here's a little demo:
> >
> > ----------
> > -- setHadler bug.exw
> >
> > without warning
> > include win32lib.ew
> >
> > constant
> >     Win = create( Window, "setHandler bug", 0, Default, Default, 640,
480,
> > 0 ),
> >     TV = create( TreeView,
> >                "Treeview",
> >                 Win,
> >                 0,
> >                 0,
> >                 250, --CW_USEDEFAULT,
> >                 300, --CW_USEDEFAULT,
> >                 or_all({TVS_HASLINES, TVS_LINESATROOT, TVS_HASBUTTONS,
> >                         TVS_SHOWSELALWAYS,
> >                         TVS_NONEVENHEIGHT,
> >                         TVS_EDITLABELS,
> >                         TVS_INFOTIP
> >                         }))
> >
> >
> > procedure on_event (atom event, object wParam, object lParam)
> >     if event = WM_NOTIFY then
> >         ?1
> >     end if
> > end procedure
> >
> > -------- ******************************
> > -------- ** UNCOMMENT LINE BELOW
> > -------- ** WITH onEvent
> > -------- ** AND COMMENT OUT setHandler()
> > -------- ** TO SEE THE DIFFERENCE
> > -------- ******************************
> > -- onEvent [Win] = routine_id ("on_event")
> > setHandler (Win, w32HEvent, routine_id ("on_event"))
> >
> > WinMain (Win, Normal)
> >
> > ----- Original Message -----
> > From: "Derek Parnell" <ddparnell at bigpond.com>
> > To: "EUforum" <EUforum at topica.com>
> > Sent: Sunday, June 16, 2002 7:53 AM
> > Subject: Re: setHandler bug
> >
> >
> > >
> > > Hi Tone,
> > > I couldn't reproduce the effect you described. When I tried, I got
> > WM_NOTIFY
> > > events using both methods.
> > >
> > > Is there anything else you can give me to try and find the problem?
> > >
> > > ----- Original Message -----
> > > From: <tone.skoda at gmx.net>
> > > To: "EUforum" <EUforum at topica.com>
> > > Sent: Sunday, June 16, 2002 10:10 AM
> > > Subject: setHandler bug
> > >
> > >
> > > >
> > > > If I use
> > > > setHandler (tree_parent, w32HEvent, routine_id
("tree_parent_event"))
> > > > then tree_parent_event() doesn't receive any WM_NOTIFY messages.
> > > >
> > > > If I use
> > > > onEvent [tree_parent] = routine_id ("tree_parent_event")
> > > > it does receive WM_NOTIFY.
> > > >
> > > >
> > > >
>
>
>

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

Search



Quick Links

User menu

Not signed in.

Misc Menu