Re: Multiple dialogs question [message #3974] |
Wed, 12 April 1995 00:00 |
zawodny
Messages: 121 Registered: August 1992
|
Senior Member |
|
|
In article <Pine.SOL.3.91.950412113453.7588A-100000@chroma> Russ Welti <rwelti@chroma.mbt.washington.edu> writes:
>
> If I already have a good standalone dialog, using widgets, and I
> want to be able to have multiple instances of it in one IDL session,
> I run into problems because the COMMONs of the second instance overwrite
> those of the first, so that the first dialog loses track of its critical
> data.
>
> I understand why it happens, but does anyone have a painless way to
> change the source to allow multiple instances? All I can think of is
> major surgery, where the COMMON data becomes *arrays* of data, and
> then I construct UVALUES at build-time which indicate (at event-time)
> which array element from the COMMON to look at. Yuck. Isn't there
> something I'm missing -- something faster/easier?
After some careful thought you should be able to convince yourself
that common blocks are not required at all. All information can be
stored as uvalues in the various widgets. Unfortunately, people use
common blocks because they are very easy to implement. There is no
painless way to switch over to storing everything in uvalues unless
you convert all of your common block contents into a structure and
store it as the uvalue of the base (or root) widget. This is not the
optimal utilization of resources, but should work. Remember, that
every widget or event can be used to find the id of the base widget.
If you futher require that the multiple occurences of your "standalone
dialog"s communicate with each other than you'll have to create
base widget whose sole purpose is to spawn off these dialogs and keeps
track of thier widget_id's. In this instance the "common block"
structure can be saved in the uvalue of the child widgets.
Good luck,
--
Joseph M. Zawodny (KO4LW) NASA Langley Research Center
Internet: j.m.zawodny@larc.nasa.gov MS-475, Hampton VA, 23681-0001
TCP/IP: ko4lw@ko4lw.ampr.org Packet: ko4lw@n4hog.va.usa.na
|
|
|