Path: utzoo!attcan!uunet!cs.utexas.edu!tut.cis.ohio-state.edu!bloom-beacon!EXPO.LCS.MIT.EDU!converse From: converse@EXPO.LCS.MIT.EDU (Donna Converse) Newsgroups: comp.windows.x Subject: Re: can't destroy widget when I want to Message-ID: <8904211511.AA23643@expo.lcs.mit.edu> Date: 21 Apr 89 15:11:38 GMT References: <2437@lll-lcc.UUCP> Sender: daemon@bloom-beacon.MIT.EDU Organization: X Consortium, MIT Laboratory for Computer Science Lines: 40 >[description of image-processing application using toolkit, > retain image on screen until user clicks...] >The Core widgets are >globally declared with a NULL initialization. I assume you mean that there are global variables, initialized to NULL, which receive the widget id at widget creation time. > 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 Yes, these global variables in your program should hold the value returned by XtCreateManagedWidget() or XtCreateWidget(), and they should not change unless you reassign their value. They should not be NULL after you create the widgets. How about running dbx or saberC and determining when their value changes? >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. Well, if you have the widget ID, then you can destroy the widget. Same goes for gc's and pixmaps. > 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? Recycle! >If recycling is best, what X routines do I use? You can unmap the widgets if you want them to disappear without being destroyed. Drawing in a widget is no different the nth time than it is in the first time. You may have to do an XClearArea to clear the widget's window; you can do that the first time too. Donna