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

Conference noted::motif

Title:"OSF/Motif" is a trademark
Notice:MOTIF kit note in 7.*
Moderator:GOOEY::GRASS
Created:Mon Aug 07 1989
Last Modified:Thu Jun 05 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:5973
Total number of notes:24620

5932.0. "Question about XmForm and unmaneged child" by TKTV20::HASHIMOTO () Mon Mar 03 1997 05:19

A customer has a trouble about XmForm on Motif V1.2.

When this program is activated, 4 widgets (pb_manage,pb_unmanage,fm_test and
px_exit) appear on fm_main.  2 label widgets (lb_test1 and lb_test2) are
children of fm_test.
He wants to remove lb_test2 from fm_test by clicking 'pb_unmanage' button
and change the size of fm_test.
When 'pb_unmanage' is clicked,  Lb_test2 is unmanaged and the label
'TEST-02' disappers successfully, but the height of fm_test will never shrink.

My questions are:
1. Is this a Motif bug or something is wrong in his program ?
2. On Motif V1.2-4, this program seems to work O.K.
   What is the difference between these versions ?

Any information are welcome.
Regards,

Junshi


[ V1.2 ]
------------------------------------------------------
OpenVMS VAX				V6.1
DECwindows ident is                     DW T1.2-931116
DECwindows server ident is              DW V6.1-940212
DECwindows transport ident is           DW V6.1-940212
DECwindows xlib ident is                DW T1.2-931116
DECwindows motif toolkit ident is       DW T1.2-931116
DECwindows apps ident is                DW T1.2-931116
DECwindows programming ident is         DW T1.2-931116
------------------------------------------------------

[ V1.2-4 ]
------------------------------------------------------
OpenVMS Alpha				V6.2
DECwindows ident is                     DW V1.2-4960312
DECwindows server ident is              DW T6.2-950505
DECwindows transport ident is           DW T6.2-950505
DECwindows xlib ident is                DW V1.2-4960312
DECwindows motif toolkit ident is       DW V1.2-940307
DECwindows apps ident is                DW V1.2-4960312
DECwindows programming ident is         DW V1.2-940307
------------------------------------------------------
T.RTitleUserPersonal
Name
DateLines
5932.1test2.cTKTV20::HASHIMOTOMon Mar 03 1997 05:2065
#include <stdio.h>
#include <stdlib.h>
#include <unixlib.h>

#include <Mrm/MrmAppl.h>
#include <Mrm/MrmPublic.h>
#include <X11/StringDefs.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <Xm/Xm.h>
#include <Xm/Text.h>
#include <locale.h>
                   
static Widget	eWidget[10] ;

void create_proc(Widget w ,int *tag ){ eWidget[*tag] = w ; }   

void manageCB(Widget w , int *tag) 
{
  XtManageChild(eWidget[*tag]) ;
}

void unmanageCB(Widget w , int *tag) 
{
  XtUnmanageChild(eWidget[*tag]) ;
}

void exitCB(void) { exit(1) ; }

static MRMRegisterArg reglist[] = {
	{"create_proc"	,(XtPointer)create_proc},
	{"manageCB"	,(XtPointer)manageCB} ,
	{"exitCB"	,(XtPointer)exitCB} ,
	{"unmanageCB"	,(XtPointer)unmanageCB}
};                                               
                                       
static int 	reglist_num 	= sizeof(reglist) / sizeof(MRMRegisterArg) ;
static char 	*filename_list[]= {"test2.uid" };
static int  	fnum 		= sizeof(filename_list)/sizeof(char *) ;

int main ( int argc, char **argv)          
{
  XtAppContext	app_context;
  MrmHierarchy 	hierarchy;                                     
  MrmCode 	class;
  Widget 	toplevel ;
  Widget 	fm;

  MrmInitialize();
  XtSetLanguageProc(NULL,NULL,NULL) ;
  toplevel =XtAppInitialize(&app_context,"jbxdtp",NULL,0,&argc,argv,NULL,NULL,0) ;
  if ( MrmOpenHierarchy ( fnum,filename_list,NULL, &hierarchy ) != MrmSUCCESS ){
	printf("%s: can't open mrm hierarchy, exiting...\n", argv[0]);
	exit (-1);
  }                                                      
  if ( MrmRegisterNames ( reglist, reglist_num ) != MrmSUCCESS ) {
	printf("%s: can't register mrm names, exiting...\n", argv[0]);
	exit (-1);                           
  }                              
  MrmFetchWidget ( hierarchy, "fm_main", toplevel, &fm, &class );

  XtManageChild(fm) ;  
  XtRealizeWidget (toplevel);                
  XtAppMainLoop (app_context);               
}                                        
5932.2test2.uilTKTV20::HASHIMOTOMon Mar 03 1997 05:20132
module XApplication

    version 		= 'v1.0'
    names 		= case_sensitive

procedure 
	create_proc (integer);
	manageCB(integer) ;
	unmanageCB(integer) ;
	exitCB;


include file "XmAppl.uil";

object fm_main : XmForm {
	controls{
		XmPushButton		pb_manage;
		XmPushButton		pb_unmanage;      
                XmForm			fm_test ;
		XmPushButton		pb_exit ;
	};
	arguments {
		XmNautoUnmanage 	= false;
		XmNnoResize		= true ;
		XmNresizePolicy		= XmRESIZE_ANY ;
 	};
	callbacks {
        	MrmNcreateCallback	= procedure create_proc(0) ;
	} ;                                                
};


object pb_manage : XmPushButton {
	arguments {
 		XmNtopAttachment   	= XmATTACH_FORM;
		XmNtopOffset 	   	= 10;
		XmNleftAttachment  	= XmATTACH_FORM;
		XmNleftOffset 	   	= 10 ;
	};
	callbacks {
		XmNactivateCallback	= procedure  manageCB(2);
	} ;
};


object pb_unmanage : XmPushButton {
	arguments {
 		XmNtopAttachment   	= XmATTACH_FORM;
		XmNtopOffset 	   	= 10;
		XmNleftAttachment  	= XmATTACH_WIDGET;
		XmNleftWidget 	   	= XmPushButton	pb_manage ;
		XmNleftOffset 	   	= 10 ;
		XmNrightAttachment 	= XmATTACH_FORM;         
		XmNrightOffset 	   	= 10 ;
	};
	callbacks {
		XmNactivateCallback	= procedure  unmanageCB(2);
	} ;
};

object fm_test : XmForm {
	controls{
		XmLabel		lb_test1 ;
		XmLabel		lb_test2 ;
	};
	arguments {
 		XmNtopAttachment   	= XmATTACH_WIDGET ;
		XmNtopWidget 	   	= XmPushButton	pb_manage ;
		XmNtopOffset 	   	= 10;
		XmNleftAttachment  	= XmATTACH_FORM;
		XmNleftOffset 	   	= 10 ;
		XmNrightAttachment 	= XmATTACH_FORM;
		XmNrightOffset 	   	= 10 ;
		XmNshadowThickness	= 2 ;
		XmNshadowType		= XmSHADOW_IN ;
	};
	callbacks {
        	MrmNcreateCallback	= procedure create_proc(1) ;
	} ;
};


object lb_test1 : XmLabel {
	arguments {
		XmNlabelString		= " TEST - 01 " ;
 		XmNtopAttachment   	= XmATTACH_FORM;
		XmNtopOffset 	   	= 10;
		XmNleftAttachment  	= XmATTACH_FORM;
		XmNleftOffset 	   	= 10 ;
		XmNrightAttachment 	= XmATTACH_FORM;
	};
	callbacks {
	} ;
};

object lb_test2 : XmLabel {
	arguments {
		XmNlabelString		= " TEST - 02 " ;
 		XmNtopAttachment   	= XmATTACH_WIDGET ;
		XmNtopWidget 	   	= XmLabel lb_test1 ;
		XmNtopOffset 	   	= 10;
		XmNleftAttachment  	= XmATTACH_FORM;
		XmNleftOffset 	   	= 10 ;
		XmNrightAttachment 	= XmATTACH_FORM;
		XmNrightOffset 	   	= 10 ;
		XmNbottomAttachment	= XmATTACH_FORM;
		XmNbottomOffset    	= 10 ;
	};
	callbacks {
        	MrmNcreateCallback	= procedure create_proc(2) ;
	} ;
};

object pb_exit : XmPushButton {
	arguments {
		XmNlabelString		= " exit  " ;
 		XmNtopAttachment   	= XmATTACH_WIDGET ;
		XmNtopWidget 	   	= XmForm	fm_test ;
		XmNtopOffset 	   	= 10;
		XmNleftAttachment  	= XmATTACH_FORM;
		XmNleftOffset 	   	= 10 ;
		XmNrightAttachment 	= XmATTACH_FORM;
		XmNrightOffset 	   	= 10 ;
		XmNbottomAttachment	= XmATTACH_FORM;
		XmNbottomOffset    	= 10 ;
	};
	callbacks {
		XmNactivateCallback	= procedure  exitCB;
	} ;
};

end module;