[comp.windows.x.motif] Unresizable windows ?

stauffer@masg1.epfl.ch (Laurent Stauffer) (03/11/91)

How can I specify to the window manager that windows created
by my application are not allowed to be resized ? 
I can't set the "XmNminWidth", "XmNmaxWidth", "XmNminHeight" and 
"XmNmaxHeight" resources of the corresponding applicationSell Widget 
because I don't know the size of the window at creation time.
I tried unsuccessfully to get the height and width of the window after
the applicationSell Widget had been popup and to set the four above 
resources with the got values :

#include <Intrinsic.h>
#include <StringDefs.h>
#include <Label.h>

int main(Cardinal argc,char **argv) {
	int i;
	Arg args[5];
	Widget	hello,toplevel;
	Dimension larg,haut;

	toplevel = XtInitialize(argv[0],"XHello",NULL,0,&argc,argv);
	hello = XtCreateManagedWidget("hello",xmLabelWidgetClass,
	                              toplevel,NULL,0);
	
	XtRealizeWidget(toplevel);

	i=0;
	XtSetArg(args[i],XmNheight, &haut);i++; 
	XtSetArg(args[i],XmNwidth, &larg);i++; 
	XtGetValues(toplevel,args,i);

	i=0;
	XtSetArg(args[i],XmNminHeight, haut);i++; 
	XtSetArg(args[i],XmNminWidth, larg);i++; 
	XtSetArg(args[i],XmNmaxHeight, haut);i++; 
	XtSetArg(args[i],XmNmaxWidth, larg);i++; 
	XtSetValues(toplevel,args,i);	

	XtMainLoop();
}

-- 
Laurent Stauffer    <stauffer@masg1.epfl.ch>
ROSO - DMA - EPFL  
Ecublens       1015 Lausanne   
SUISSE           

david@lta.lta.com (David B. Lewis) (03/12/91)

> How can I specify to the window manager that windows created
> by my application are not allowed to be resized ? 

>From the current comp.windows.x frequently-answered-questions list:

----------------------------------------------------------------------
Subject: 109)  How do I keep a window from being resized by the user?

	Resizing the window is done through the window manager; window managers
can pay attention to the size hints your application places on the window, but 
there is no guarantee that the window manager will listen. You can try setting 
the minimum and maximum size hints to your target size and hope for the best. 
[1/91]
----------------------------------------------------------------------

-- 
David B. Lewis  			Lewis, Trachtenberg & Associates (LTA)
Note new address!:  david@lta.com	+1 617 225 0366

Some financial models, on the other hand, yield a positive societal value for a
pack of cigarettes: smokers ... inflate group life-insurance premiums, but they
tend to die before costing society much in pensions or nursing-home care. - SA

morten@modulex.dk (Morten Hastrup) (03/13/91)

stauffer@masg1.epfl.ch (Laurent Stauffer) writes:


>How can I specify to the window manager that windows created
>by my application are not allowed to be resized ? 
>I can't set the "XmNminWidth", "XmNmaxWidth", "XmNminHeight" and 
>"XmNmaxHeight" resources of the corresponding applicationSell Widget 
>because I don't know the size of the window at creation time.

If you are using Motif you can remove the resize-handler by setting
the XmNmwmDecorations at the shell to: "-resizeh"

This is the proper way in Motif, because it shows the user that the
application can't be resized.

Morten

-----------------------------------------------------
Morten Hastrup		| Email:    morten@modulex.dk
A/S MODULEX		| Phone:    +45 44 53 30 11
Lyskaer 15		| Telefax:  +45 44 53 30 74
DK-2730 Herlev		|
Denmark			|