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

Re: Objects with Widgets, Save/Restore

JD Smith writes:
> The secret is this same notion of pruning out the bits you don't need. 
> Here's a sketch of how I'd approach your problem.
> pro DavidsPlayhouse::Restore
>   oldself=self               ;for killing later
>   wInfo=self.wInfo           ;save the GUI, eat soy products
>   self.wInfo=ptr_new()	     ;detach, avoiding the carnage
>   restore_obj, self.SaveFile ;travel back in time
>   obj_destroy,oldself        ;kill our old self, except wInfo
>   self.wInfo=wInfo           ;reattach our saved widget info
>   self->UpdateGUI            ;I'm not who I think I am
> end

Humm. Since I'm within hours of delivering
the first truly production version of this
code, I'm loath to open up this topic again.

But I think now what got me into trouble
is that inside my larger application, which
is written as an object, there was an
ROI Window Object. This is a compound widget 
(window) that doesn't have any notion of what's 
inside it, but it can draw various types of
ROI's on itself.  This too is written as an object,
and it reports its results (perimeter points,
interior indices, etc.) to the event method handler
of the parent widget object when the ROI
is completely drawn. Of course, it relies on
widget identifiers to communicate with its
"parent" properly. And it has it's own widget
identifiers to deal with.

It seems to me that I could not get this
interior widget object fired up correctly. 
Although it seems to me now (as then) that
the approach you outline above should work in
both cases. And, of course, that is what I
*thought* I was doing. 

But when the customer is paying you big bucks
and is already happy with the design, it seems
the height of arrogance to spend yet more time
on niggling cosmetic problems. Especially when
the other solution was so easy (it took me about
10 minutes to implement). Even my overly
obsessive compulsion for neatness can be
bought at the right price. :-)

But I'll have another go next time. I'm convinced
it has to work. Maybe when I figure it out I'll
have enough material for that object book. 



David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155