Any sugg. 4 adapting to new IDL widget keyword NO_COPY? [message #4675] |
Wed, 12 July 1995 00:00 |
pierce
Messages: 1 Registered: July 1995
|
Junior Member |
|
|
I'm just adapting my programs to IDL's new method of compound-widget
state-management which uses the NO_COPY keyword to WIDGET_CONTROL
instead of the CW_LOADSTATE/SAVESTATE. For simply CW's, the process
is relatively painless. But I have major programs which are essentially
CWs. Routines inside such CWs must call other routines in the same CW;
users of the CW must also be able to call CW routines. The best method
I could come up with is as follows:
Routines which must be called by both users and other CW routines
all take the keyword STATE. When one CW routine calls another, the
first passes its state (by reference) to the second via the STATE
keyword. The second routine uses & perhaps modifies the state, then
returns. It is up to the caller to make sure that the state was loaded
out of the UVAL at the beginning and to make sure that it's put back
when the caller's done.
When a user calls a CW routine, however, the routine sees that the
STATE keyword is undefined and thus loads the state itself & saves it
when its done.
Since all this passing of states got somewhat cumbersome, I, in some
cases, had the CW caller load the state into a common block & unload
it when finished.
Even this already rather inelegant strategy did not suffice. IDL
wouldn't let me access the UVAL stash of my dying widget from my CLEAN
routine, so I had to leave a copy of the state in the common block just
for its use.
Basically, I'm frustrated because I never had to deal with any of this
under the CW_LOADSTATE and CW_SAVESTATE system (Sure, bugs resulted from
IDL's re-use of IDs, but now that IDL never re-uses IDs, that shouldn't
be a problem). So that's why I'm asking
Has anyone else come up with a more elegant solution to this
problem?
Is it feasible to keep using the 'OBSELETE' CW_LOADSTATE method?
I'd appreciate any input anyone has on this subject.
-Ben Stephens,
(ben@cirrus.ucsd.edu)
worker for Dave Pierce,
Scripps Institution of Oceanography
|
|
|