[comp.windows.x] Dialog

dagorn@servix.irisa.fr (Francois Dagorn) (02/14/90)

"XtNmaximumlength" resource (dialogWidgetClass) was convenient for me
to prevent the input box from growing too much. Is there a new way to
do so using X11R4 Athena's widgets ?
Thanks for help !

Francois Dagorn
Centre Inter Universitaire de Calcul de Bretagne
Campus de Beaulieu
35000 Rennes (France)
 

kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) (02/21/90)

> "XtNmaximumlength" resource (dialogWidgetClass) was convenient for me
> to prevent the input box from growing too much. Is there a new way to
> do so using X11R4 Athena's widgets ?

The "maximuLength" resource was previously used to make sure that you did not go
off the end of the array of characters allocated for the "value" resource. 
Since the R4 Text (and Dialog) widgets now manage this memory for you there is
no need for this constraint.  So I removed the maximumLength resource.

There is no simple way to do what you want, but the method described below
should do the trick.  You also can create your own "Dialog" widget by using
a Form, an AsciiText, and a few buttons to get more complex behavior.

To set a max length for the Dialog, you need to modify its "value" widget.  You
can get the "value" widget from the Dialog with XtNameToWidget(), and modify its
resources to set the "useStringInPlace" resource to TRUE.  When using this mode
you have to specify the length of the buffer, as in the R3 Text widget.  This
has the side effect of keeping your text input field smaller than "length"
characters.  Take a look at Chapter 5 of the Athena Widget documentation for
details.

						Chris D. Peterson     
						MIT X Consortium 

Net:	 kit@expo.lcs.mit.edu
Phone:   (617) 253 - 9608	
Address: MIT - Room NE43-213