| 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 | 
Hello, I have a customer working with Toolkit and UIL. She is going to use Map/Unmap callback of dialog box widget ( not popup dialog box ). Reading UIL reference manual, there are Map/Unmap callback in dialog box, and UIL compiler does not cause any errors about these callbacks, but my program does not work what I expect. I expect that when XtMapWidget and XtUnmapWidget are called, Map/Unmap callback routines should be activated. Am I misunderstanding about Map/Unmap callback reason og dialog box? Will somebody give me hints ? The programs in the reply .1, and .2 will reproduce the phenomena. Thanks in advance, Kanako Inazu /TSC/CSC/CS/Japan
| T.R | Title | User | Personal Name | Date | Lines | 
|---|---|---|---|---|---|
| 2477.1 | C program | EWBV21::INAZU_K | It's a little bit funny. | Tue Mar 20 1990 05:15 | 110 | 
| #include	<stdio.h>
#include	<decw$include/DECwDwtApplProg.h>
#define		MAXARGS 10         
int	Create(), Map(), UnMap(), Act();
static	char		*namvec[] = {"TEST.UID"};
static	DRMHierarchy	hierarchy;
static	DRMCode		class;
static	DRMRegisterArg	regvec[] = { { "Create",       	(caddr_t)Create  },
				     { "Map",        	(caddr_t)Map },
				     { "UnMap",        	(caddr_t)UnMap },
				     { "Act",        	(caddr_t)Act },
	};
Widget	top_level, mainwindow, dialog;
static int flag = 1;
                                    
#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;
	DwtInitializeDRM();
	top_level = XtInitialize( "Map/UnMap of DialogBox", 
				"Map", NULL, 0, &argc, argv );
	n = 0;
	XtSetArg( args[n], DwtNx, 200 );	n++;
	XtSetArg( args[n], DwtNy, 200 );	n++;
	XtSetValues( top_level, args, n );
	DwtOpenHierarchy( nFiles( namvec ), namvec, NULL, &hierarchy );
	DwtRegisterDRMNames( regvec, nRegs( regvec ) );
	DwtFetchWidget( hierarchy, "popmain", top_level, &mainwindow, &class );
	XtManageChild( mainwindow );
	XtRealizeWidget( top_level );
	XtMainLoop();
}
 
/*
 * ==========================
 *
 * 	CallBacks
 *
 * ==========================
 */
Create( w, tag, r )
Widget w;
char   *tag;
DwtAnyCallbackStruct *r;
{
	if( *tag == 2 ){
		dialog = w;
	}
}
Map( w, tag, r )
Widget w;
char   *tag;
DwtAnyCallbackStruct *r;                  
{
	printf("This is Map() callback.\n" );
}
UnMap( w, tag, r )
Widget w;
char   *tag;
DwtAnyCallbackStruct *r;
{
	printf("This is UnMap() callback.\n" );
}
Act( w, tag, r )
Widget w;
char   *tag;
DwtAnyCallbackStruct *r;
{
	if( *tag == 2 ){
		exit(1);
	}
	if( *tag == 1 ){
		if( flag == 0 ){
			XtMapWidget( dialog );
		    flag = 1;
		}else{
			XtUnmapWidget( dialog );
		    flag = 0;
		}
	}
}
 | |||||
| 2477.2 | UIl | EWBV21::INAZU_K | It's a little bit funny. | Tue Mar 20 1990 05:16 | 93 | 
| module text
	version = 'v1.0'
	names = case_sensitive
include file  "DECw$Include:DwtAppl.uil";
procedure
	Create( integer );
	Map( );
	UnMap( );
	Act( integer );
object
       popmain : main_window{
		arguments{
			width = 400;
			height= 200;
		};
		controls{
			dialog_box dialog;
			dialog_box dialog1;
		};
		callbacks{
			create = procedure Create(1);
		};
};
object
	dialog1 : dialog_box{
		arguments{
			units = DwtPixelUnits;
			width = 200;
			height = 200;
			x = 0;
			y = 0;
			background_color = color( "White" );
		};
		controls{
			push_button button01;
			push_button button02;
		};
};
object
	dialog : dialog_box{
		arguments{
			units = DwtPixelUnits;
			width = 200;
			height = 200;
			x = 200;
			y = 0;
			background_color = color( "LightBlue" );
		};
		callbacks{
			create = procedure Create(2);
			map = procedure Map();
			unmap = procedure UnMap();
		};
};
object	button01 : push_button{
	arguments{
		x = 10;
		y = 10;
		label_label = compound_string( "Map/UnMap" );
		highlight_color    = color( "Magenta" );
		foreground_color = color( "Magenta" );
		background_color = color( "Pink" );
		shadow = false;
	};                  
	callbacks{
		activate = procedure Act(1);
	};	
};
object	button02 : push_button{
	arguments{
		x = 10;
		y = 60;
		label_label = compound_string( "Exit" );
		highlight_color    = color( "Magenta" );
		foreground_color = color( "Magenta" );
		background_color = color( "Pink" );
		shadow = false;
	};                  
	callbacks{
		activate = procedure Act(2);
	};	
};
end module;             
 | |||||
| 2477.3 | Popup only | LEOVAX::TREGGIARI | Thu Mar 29 1990 08:05 | 3 | |
|     I think map/unmap callbacks only apply to pop-up dialog boxes.
    
    Leo
 | |||||