comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: setting widget " EVENT_PRO='myClass::myCallback' " ???? Is it possible?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: setting widget " EVENT_PRO='myClass::myCallback' " ???? Is it possible? [message #83977 is a reply to message #83974] Mon, 15 April 2013 11:39 Go to previous messageGo to previous message
DavidF[1] is currently offline  DavidF[1]
Messages: 94
Registered: April 2012
Member
Justin writes:
>
> I have been unable to set EVENT_PRO to a class method. My current work around is to create a dummy 'global' standalone function at the top of the *__DEFINE.pro file that pulls the object data and then calls the method on the object. I was curious if it is even possible to set a widget event handler to a class method.

Yes, the general approach is to have a single event handler (I call it an event dispatcher) that accepts all program events and dispatches them to the correct event handler method. How you determine the "correct" event handler method is up to you. I generally use some combination of the user value (UVALUE) or user name (UNAME) value of the widget that is causing the event (or sometimes its parent). The dispatching event handler simply calls Call_Method on the self object (stored in the UVALUE of the TLB or anywhere else where you can find it) with the name of the desired event handler method.

This works great, but requires you do the same thing with callback routines like CLEANUP, KILL_NOTIFY, etc. It can be a hassle, but the benefits of object-widgets often outweighs it.

> What is the rationale behind not letting an event handler be a class method? Perhaps it doesn't make sense to do it...

Rationale!? You are using the wrong language. Maybe there will be a rationale with the new widget set, due out soon, I should think. :-)

Cheers,

David
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: setting widget " EVENT_PRO='myClass::myCallback' " ???? Is it possible?
Next Topic: Re: How to Zip cross-platform from IDL?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 19:33:15 PDT 2025

Total time taken to generate the page: 1.92116 seconds