[comp.windows.x.motif] XmNdestroryCallback on a SelectionBoxDialog...

CWIKLA@uimrl7.mrl.uiuc.edu (John/Consultant) (05/29/91)

	I do the following:

	I use the convenience function XmCreateSelectionDialog.
	I set autounmanage to false.
	I then add a callback for the cancel button.
	I then add a callback for XmNdestroyCallback.

	I am trying to use XtDestroyWidget inside the cancel button
	callback (I actually try to destroy the DialogShell parent
	of the callback widget...)

	However this does not work -- program crashes...

	Is this the correct way to do this...I basically want
	to trash the entire dialogshell and selectionbox child.


Thanks in advance,
John


******************************************************************************
*  John L. Cwikla             *   cwikla@uiucmrl, cwikla@uimrl7.mrl.uiuc.edu *
*  Chief Consultant, MRLCFC   *	  uimrl::cwikla		(217)333-8281        *
*  University of Illinois     *   Redefining Lunacy...			     *
******************************************************************************

lyons@srg (Don R. Lyons x4811) (05/30/91)

In article <1991May29.024641.21512@ux1.cso.uiuc.edu> CWIKLA@uimrl7.mrl.uiuc.edu (John/Consultant) writes:

>	   I am trying to use XtDestroyWidget inside the cancel button
>	   callback (I actually try to destroy the DialogShell parent
>	   of the callback widget...)
>
>	   However this does not work -- program crashes...

	In Motif 1.0.* for X11R3 this behavior is, unfortunately, correct.
	The bug with calling XtDestroyWidget has been fixed in Motif 1.1.*
	for X11R4, so the release notes claim. I am still waiting for
	source so can someone verify?

	Anyways, the work around we did for Motif 1.0.* for X11R3 is to
	add the widget to a list of widgets to be destroyed in the
	callback and did a XtAddWorkProc to register a one-shot function
	that calls XtDestroyWidget on the widgets in the list. Of course,
	the function registered with XtAddWorkProc will be called when
	you return to the event loop.

	
--
Don R Lyons                          Any opinions expressed are my own.
Arinc Research Inc                   uucp : uunet!srg!lyons
SRG, Mail Stop 5230                  voice: 301 266 4811
2551 Riva Road Annapolis , MD 21401  fax  : 301 266 2047

roger@zuken.co.jp (Roger Meunier) (05/30/91)

In article <LYONS.91May29140930@oberon.srg> lyons@srg (Don R. Lyons x4811) writes:

 > In article <1991May29.024641.21512@ux1.cso.uiuc.edu> CWIKLA@uimrl7.mrl.uiuc.edu (John/Consultant) writes:
 > 
 > >	   I am trying to use XtDestroyWidget inside the cancel button
 > >	   callback (I actually try to destroy the DialogShell parent
 > >	   of the callback widget...)
 > >
 > >	   However this does not work -- program crashes...
 > 
 > 	   In Motif 1.0.* for X11R3 this behavior is, unfortunately, correct.
 > 	   The bug with calling XtDestroyWidget has been fixed in Motif 1.1.*
 > 	   for X11R4, so the release notes claim. I am still waiting for
 > 	   source so can someone verify?

I had posted some source several weeks ago which illustrated the problem
(and to which no one cared to respond... GRRRR).  We just received X11R4
and Motif 1.1 last week, and my test program no longer crashes, so I assume
that the problem has been worked around.  Hats off to them bug fixers!

Now, if they'd only find a way to make XtMakeGeometryRequest() work
within a XmForm, then I'd *really* be happy!!! ;-)
--
Roger Meunier @ Zuken, Inc.  Yokohama, Japan	(roger@zuken.co.jp)

kern@asterix.cadlab.de (Thomas Kern) (06/03/91)

In article <ROGER.91May30151015@rd1s.zuken.co.jp>, roger@zuken.co.jp (Roger Meunier) writes:
|> In article <LYONS.91May29140930@oberon.srg> lyons@srg (Don R. Lyons x4811) writes:
|> 
|>  > In article <1991May29.024641.21512@ux1.cso.uiuc.edu> CWIKLA@uimrl7.mrl.uiuc.edu (John/Consultant) writes:
|>  > 
|>  > >	   I am trying to use XtDestroyWidget inside the cancel button
|>  > >	   callback (I actually try to destroy the DialogShell parent
|>  > >	   of the callback widget...)
|>  > >
|>  > >	   However this does not work -- program crashes...
|>  > 
|>  > 	   In Motif 1.0.* for X11R3 this behavior is, unfortunately, correct.
|>  > 	   The bug with calling XtDestroyWidget has been fixed in Motif 1.1.*
|>  > 	   for X11R4, so the release notes claim. I am still waiting for
|>  > 	   source so can someone verify?
|> 
|> I had posted some source several weeks ago which illustrated the problem
|> (and to which no one cared to respond... GRRRR).  We just received X11R4
|> and Motif 1.1 last week, and my test program no longer crashes, so I assume
|> that the problem has been worked around.  Hats off to them bug fixers!
|> 

Actually, there is no need to destroy the DialogShell explicitly. All
Motif XmCreate...Dialog() functions add a callback to the DialogShell's 
child to destroy its parent -- which is the DialogShell!
Just call XtDestroyWidget() for the Widget-Id which is returned from
your XmCreate...Dialog() function and everything should be ok -- at least
for Motif 1.1. 

I don't no if this behaviour is documented, probably not ;-).

|> Now, if they'd only find a way to make XtMakeGeometryRequest() work
|> within a XmForm, then I'd *really* be happy!!! ;-)
|> --
|> Roger Meunier @ Zuken, Inc.  Yokohama, Japan	(roger@zuken.co.jp)

What do you mean?

-- 
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Thomas Kern       |       Tel.  : (+49) (+) 5251-284 111                 |
| CADLAB            |       Fax   : (+49) (+) 5251-284 140                 |
| Bahnhofstr. 32    |       E-Mail: kern@cadlab.uucp                       |
| D-4790 Paderborn  |               kern@cadlab.cadlab.de                  |
| Germany           |               ...!uunet!unido!cadlab!kern            |
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

roger@zuken.co.jp (Roger Meunier) (06/05/91)

In article <1991Jun3.080854.13064@uni-paderborn.de> kern@asterix.cadlab.de (Thomas Kern) writes:

 > Actually, there is no need to destroy the DialogShell explicitly. All
 > Motif XmCreate...Dialog() functions add a callback to the DialogShell's 
 > child to destroy its parent -- which is the DialogShell!

There is a "need" when the application wants to control the lifetime
of each Dialog, and when the parent decides when the child should be
destroyed.

 > |> Now, if they'd only find a way to make XtMakeGeometryRequest() work
 > |> within a XmForm, then I'd *really* be happy!!! ;-)
 > 
 > What do you mean?

I mean that I have yet to find a way to move a widget whose parent is
a form using XtMakeGeometryRequest().  I can't even do it using XmNx
and XmNy through Set[Va]Values().  Changing the attachment values seems
to work, but is not very elegant, especially when the position in the
form isn't originally determined by form constraints.

Anyone had any success with moving widgets in a form?
--
Roger Meunier @ Zuken, Inc.  Yokohama, Japan	(roger@zuken.co.jp)