[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bulova::decw_jan-89_to_nov-90

Title:DECWINDOWS 26-JAN-89 to 29-NOV-90
Notice:See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit
Moderator:STAR::VATNE
Created:Mon Oct 30 1989
Last Modified:Mon Dec 31 1990
Last Successful Update:Fri Jun 06 1997
Number of topics:3726
Total number of notes:19516

3606.0. "question about "modal" dialog box" by EWBV21::INAZU_K (It's a little bit funny) Wed Nov 07 1990 19:49

	Hello,

	I have a question about "modal" popup dialog box.
	Is it an authoized way to manage another "modal" popup dialog box
	in the callback of "modal" popup dialog box?

	An aplication developed by my customer uses many "modal" popup dialog
	successively. In this application, a "modal" dialog is managed in
	the callback of another "modal" dialog. Of course, the dialog box 
	appears on the screen but this widget does not "grab" input focus.
	We can do input data in other widgets. The modal widget managed in the 
	callback of another modal widget looks like modal, but it is modeless,
	in fact.

	We get the following Toolkit warning message,

	XtRemoveGrab asked to remove a widget not on the grab list.

	Are there any documetation like "you should not manage a widget in
	modal dialog box" ?  Or is this a bug?

	Thanks in advance,

				Kanako Inazu /TSC/CSC/CS/Japan

	The program that you can reproduce the problem is as follows.

====================== MORI.C ======================
#include	<stdio.h>
#include	<decw$include/DwtAppl.h>

#define		MAXARGS 10         
#define		XOFFSET 200
#define		YOFFSET 200
#define		XPOS    150
#define		YPOS    150

static	void	HaHa();

static	char		*namvec[] = {"MORI.UID"};

static	DRMHierarchy	hierarchy;
static	DRMCode		class;
static	DRMRegisterArg	regvec[] = { { "HaHa",	       (caddr_t)HaHa }
	};

Widget	top_level, dialog, 
	pop0, pop1, pop2, pop3, pop4, pop5, pop6, pop7, pop8;
                                    
#define	nFiles(x)	( sizeof(x) / sizeof( char * ) )
#define	nRegs(x)	( sizeof(x) / sizeof( DRMRegisterArg ) )

/*
 * ==========================
 *
 * 	Main Program                         
 *
 * ==========================
 */

main( argc, argv )
unsigned long	argc;
char		*argv[];
{
	Arg	args[MAXARGS];
	long	n;
	XEvent  event;
	int	stat;

	DwtInitializeDRM();
	top_level = XtInitialize( "MORI", "Demo", NULL, 0, &argc, argv );

	DwtOpenHierarchy( nFiles( namvec ), namvec, NULL, &hierarchy );
	DwtRegisterDRMNames( regvec, nRegs( regvec ) );
	DwtFetchWidget( hierarchy, "main", top_level, &dialog, &class );
	DwtFetchWidget( hierarchy, "pop0", top_level, &pop0, &class );
	DwtFetchWidget( hierarchy, "pop1", top_level, &pop1, &class );
	DwtFetchWidget( hierarchy, "pop2", top_level, &pop2, &class );
	DwtFetchWidget( hierarchy, "pop3", top_level, &pop3, &class );
	DwtFetchWidget( hierarchy, "pop4", top_level, &pop4, &class );
	DwtFetchWidget( hierarchy, "pop5", top_level, &pop5, &class );
	DwtFetchWidget( hierarchy, "pop6", top_level, &pop6, &class );
	DwtFetchWidget( hierarchy, "pop7", top_level, &pop7, &class );
	DwtFetchWidget( hierarchy, "pop8", top_level, &pop8, &class );

	XtManageChild( dialog );
	XtManageChild( pop0 );
	XtRealizeWidget( top_level );

	XtMainLoop();
}
 
/*
 * ==========================
 *
 * 	CallBacks
 *
 * ==========================
 */

static void HaHa( w , tag, reason )
Widget	w;
int	*tag;
DwtAnyCallbackStruct *reason;
{
	if( *tag == 0 ){
		XtManageChild( pop1 );
	}
	else if( *tag == 1 ){
		XtManageChild( pop2 );
	}
	else if( *tag == 2 ){
		XtManageChild( pop3 );
	}
	else if( *tag == 3 ){
		XtManageChild( pop4 );
	}
	else if( *tag == 4 ){
		XtManageChild( pop5 );
	}
	else if( *tag == 5 ){
		XtManageChild( pop6 );
	}
	else if( *tag == 6 ){
		XtManageChild( pop7 );
	}
	else if( *tag == 7 ){
		XtManageChild( pop8 );
	}
	else if( *tag == 8 ){
		exit();
	}
}


====================== MORI.UIL ======================





module	Labo
	version = "v1.0"
	names	= case_sensitive

	objects = {
		separator = gadget;
	}

include file  "DECw$Include:DwtAppl.uil";

procedure
	HaHa( integer );
!
object	main : dialog_box{
	arguments{       
		width = 100;
		height = 100;
	};
	controls{
		push_button 	button0;
	};
};                                

object	button0 : push_button{
	arguments{       
	 	label_label = compound_string( "Manage Popup 1" );
	};
	callbacks{
		activate = procedure HaHa(0);
	};
};

!

object	pop0 : popup_dialog_box{
	arguments{
		x = 500;
		y = 100;
		width = 100;
		height = 100;
	};             
	controls{
		simple_text	text01;
	};
};

object	text01	: simple_text{
	arguments{
		x = 10;
	};
};

object	pop1 : popup_dialog_box{
	arguments{
		x = 100;
		y = 100;
		width = 100;
		height = 100;
		take_focus = true;
		style = DwtModal;
	};             
	controls{
		push_button 	button1;
	};
};

object	button1 : push_button{
	arguments{       
	 	label_label = compound_string( "Manage Popup 2" );
	};
	callbacks{
		activate = procedure HaHa( 1 );
	};
};

!
object	pop2 : popup_dialog_box{
	arguments{
		x = 200;
		y = 200;
		width = 100;
		height = 100;
		style = DwtModal;
	};             
	controls{
		push_button 	button2;
	};
};

object	button2 : push_button{
	arguments{       
	 	label_label = compound_string( "Manage Popup 3" );
	};
	callbacks{
		activate = procedure HaHa( 2 );
	};
};


!
object	pop3 : popup_dialog_box{
	arguments{
		x = 300;
		y = 300;
		width = 100;
		height = 100;
		take_focus = true;
		style = DwtModal;
	};             
	controls{
		push_button 	button3;
	};
};

object	button3 : push_button{
	arguments{       
	 	label_label = compound_string( "Manage Popup 4" );
	};
	callbacks{
		activate = procedure HaHa( 3 );
	};
};


!
object	pop4 : popup_dialog_box{
	arguments{
		x = 400;
		y = 400;
		width = 100;
		height = 100;
		take_focus = true;
		style = DwtModal;
	};             
	controls{
		push_button 	button4;
	};
};

object	button4 : push_button{
	arguments{       
	 	label_label = compound_string( "Manage Popup 5" );
	};
	callbacks{
		activate = procedure HaHa( 4 );
	};
};

!
object	pop5 : popup_dialog_box{
	arguments{
		x = 500;
		y = 500;
		width = 100;
		height = 100;
		take_focus = true;
		style = DwtModal;
	};             
	controls{
		push_button 	button5;
	};
};

object	button5 : push_button{
	arguments{       
	 	label_label = compound_string( "Manage Popup 6" );
	};
	callbacks{
		activate = procedure HaHa( 5 );
	};
};

!
object	pop6 : popup_dialog_box{
	arguments{
		x = 600;
		y = 600;
		width = 100;
		height = 100;
		take_focus = true;
		style = DwtModal;
	};             
	controls{
		push_button 	button6;
	};
};

object	button6 : push_button{
	arguments{       
	 	label_label = compound_string( "Manage Popup 7" );
	};
	callbacks{
		activate = procedure HaHa( 6 );
	};
};

!
object	pop7 : popup_dialog_box{
	arguments{
		x = 700;
		y = 700;
		width = 100;
		height = 100;
		take_focus = true;
		style = DwtModal;
	};             
	controls{
		push_button 	button7;
	};
};

object	button7 : push_button{
	arguments{       
	 	label_label = compound_string( "Manage Popup 8" );
	};
	callbacks{
		activate = procedure HaHa( 7 );
	};
};

!
object	pop8 : popup_dialog_box{
	arguments{
		x = 800;
		y = 800;
		width = 100;
		height = 100;
		take_focus = true;
		style = DwtModal;
	};             
	controls{
		push_button 	button8;
	};
};

object	button8 : push_button{
	arguments{       
	 	label_label = compound_string( "Exit" );
	};
	callbacks{
		activate = procedure HaHa( 8 );
	};
};

end module;
T.RTitleUserPersonal
Name
DateLines
3606.1Try calling XtUnmanageChild on the first dialog boxLEOVAX::TREGGIARIThu Nov 08 1990 08:513
before calling XtManageChild on the second.

Leo
3606.2EWBV21::INAZU_KIt&#039;s a little bit funnyThu Nov 08 1990 21:1514
re. -1
	Thank you. It works well now.

	I modified callback routine as follows,

			.
			.
			.
		XtUnmanageChild( current_popup );
		XtManageChild( next_popup );
			.
			.
			.
						Kanako Inazu