[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Objects with Widgets, Save/Restore
Brent Griffith writes:
> I am using a handful of home-made objects (thanks to RCK's book) in a
> application with lots of widgets. I am trying to use SAVE and RESTORE
> to get my objects back to where they were in a previous run of the
> application. I have it sort of working but would appreciate seeing
> some examples of an "object's restore method".
>
> For example, is there an elegant way to deal with the widget IDs and
> values? I am storing widgetIDs in the object for widget_control
> statements, but the newly created widgets generally have different IDs
> than the old Saved-object. I find myself repeatedly writing the same
> statements for each and every widget that might get its value changed
Yes, this can be a problem. Widgets, of
course, receive a unique ID each time the
creation routine is run.
I'm not sure I have a sure-fire solution for
you, although I also have a large widget program
with lots of objects running, and I can save
and restore the current session. At least I can
after a fashion.
I guess the secret is to have some kind of GUI
method for the object widget that builds the
interface. I find this has to be separate from
the INIT method. This allows you to build a
new interface from the restored object, thus
getting all your widget identifiers sorted out
again.
I played with it for days trying to keep the
current GUI (which, of course, has the RESTORE
button on it), but no matter what I tried (and
I thought I tried some pretty sophisticated
things) I couldn't get it to work. So now when
you hit the RESTORE button, the GUI disappears
and comes back a second later with the old
session up and ready to go.
Cheers,
David
P.S. Let's just say I've had to learn to appreciate
momentary window flashing. But it is only me. My
customer has never cared two figs one way or the
other. He's just thrilled he can pick up where he
left off for lunch yesterday! :-)
--
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