[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: base widgets growing uncontrollably.... ?



JD Smith wrote:
> 
> And to point out the obvious, there's no reason you can't make compound
> widgets also objects, rather than having an all-in-one object widget
> design.  You might then have a larger object interface which "composits"
> (i.e. includes) the sub-objects directly, perhaps creating them itself.
> 
> Then, cleanup a simple matter of putting in place the relevant "Cleanup"
> methods, and cleaning up your composited objects in the master Cleanup
> (i.e. "self.fancycompoundobj1->Cleanup").  You can also allow a single
> routine to do double duty as a master kill notify and the event<->object
> interface (for those like me who cringe at littering the otherwise
> pristine namespace with non-methods):
> 
> widget_control, base,set_uvalue=self,KILL_NOTIFY="class_event",/REALIZE
> XManager,'class',base,/NO_BLOCK
> 
> Then the event callback looks like:
> 
> ;; Pass on events *AND* serve as a kill notify (destroy the object)
> pro class_event, ev_or_id
>   if size(ev_or_id,/TYPE) ne 8 then begin
>      widget_control, ev_or_id, get_uvalue=self
>      obj_destroy,self
>      return
>   endif
>   widget_control,ev_or_id.top,get_uvalue=self
>   self->Event,ev_or_id
> end

I will have to trust your much greater expertise on these matters since I'm
still in the group (probably the minority nowadays) that has no idea how to even
start using objects in IDL (I did give it a shot when it first came out in IDL
5.0(?)). When I see stuff like "self->Event,ev_or_id" the eyes glaze over and I
take a break from work and check stock quotes or a news site. :o) 

Procedurally yours,

paulv

-- 
Paul van Delst           A little learning is a dangerous thing;
CIMSS @ NOAA/NCEP        Drink deep, or taste not the Pierian spring;
Ph: (301)763-8000 x7274  There shallow draughts intoxicate the brain,
Fax:(301)763-8545        And drinking largely sobers us again.
                                         Alexander Pope.