[ba.windows.x] can't destroy widget when I want to

chapman@lll-lcc.UUCP (Carol Chapman) (04/21/89)

I am creating an application to allow a user to interactively examine
color digitized images.  I use X11R3 and Athena widgets to create a
large vpaned window.  A box widget in the vpane contains various
buttons the user can push such as Display to display images or Print
to get a screen dump of the images.  The images are displayed in a
viewport which is the bottom half of the vpane.  The viewport contains
a form widget as its child, and the form widget in turn contains 3
Core widgets which can each have an image set to be their background pixmap.
Anyway, the user may wish to examine another set of images after 
finishing with the first set, in which case he or she would push the
Display button again.  Here's the important part:  I want the first set of 
images to stay on the screen unless the user pushes the Display button again.
At that point, I would like to completely wipe out the viewport window in 
preparation for showing the next set of images.

Apparently this is easier said than done?  The Core widgets are
globally declared with a NULL initialization.  The second time that
the Display button is selected, I would hope that the Core widgets
contained the same information as when I left the routines associated
with the previous button selection.  Wrong!  The Core widgets are all
getting reinitialized to NULL, which makes it impossible for my code to
determine if there are already any images on the screen and/or to
destroy them.  I do not want to destroy the Core widgets at the end of
the routines associated with the Display button because the user
probably won't be done staring at them.  Also, I must delete all 3
images/Core widgets at about the same time because it would be
confusing to have an image from the second set displayed with images
from the previous set.  Sometimes only 2 images are displayed, and I
wouldn't want to have the 2 current images displayed with an old third
one left over beneath it, for example.

There must be some way at the *beginning* of the routines associated
with the Display button that I can destroy any previous pixmaps, gc's
and widgets on the screen.  Another question, is it best to actually
destroy the Core widgets with XtDestroyWidget and then later recreate
them with XtCreateManagedWidget, or should I be recycling the same
widgets?  If recycling is best, what X routines do I use?

Lastly, I wish to apologize for posting so often, but this net really
does seem my best way of getting answers.  Thanks to everyone who has
been helping me.  Sometimes our mailer bombs my replies to you, but I
really do appreciate all your help!

carol


-- 
-------------------------------------------------------------------------------
Livermore Lab            (chapman@lll-crg.llnl.gov or chapman@lll-lcc.llnl.gov)
P.O. Box 808, L-153      Tel. (415) 423-7876
Livermore, CA  94550     "Never own anything that you have to FEED or PAINT."