y2@DINORAH.WUSTL.EDU (04/20/89)
I have an application which requires user to select a filename out of a directory. The program is written with Athena widgets. The question is made of by a dialog widget, I am trying to provide the help (list of existing files in the directory) through a popup widget when a specific key is struck. The case I was testing has three files in the directory. The file index function we used mallocs a buffer, sets up filenames (each terminated by \n) in the buffer and returns the string pointer. Therefore, I created an overrideShellWidget with one child (formWidget). And inside this child, I placed one label widget and one AsciiStringWidget. The AsciiStringWidget was used to hold the file index. My problem is no matter how much I tried, I could not get AsciiStringWidget to resize to cover the text size. It insists to be one font high and 100 pixels long (at least it appear to be so). If anybody could give me some direction, I will be most grateful. TIA. Yeong Yeong Liu {uunet...}!wucs1!dinorah!y2 or wucs1.wustl.edu!dinorah!y2 or y2@dinorah.wustl.edu or 314-362-2950 Here is part of my code. . . n = 0; XtSetArg(args[n],XtNx,x); n++; XtSetArg(args[n],XtNy,y); n++; popupshell = XtCreatePopupShell("msg",overrideShellWidgetClass,w,args,n); . . n = 0; form = XtCreateManagedWidget("msg",formWidgetClass,popupshell,args,n); . . /* message */ n = 0; XtSetArg(args[n],XtNlabel,msg); n++; msgw = XtCreateManagedWidget("",labelWidgetClass,form,args,n); . . n = 0; XtSetArg(args[n],XtNfromVert,msgw); n++; XtSetArg(args[n],XtNstring,string_ptr); n++; XtSetArg(args[n],XtNresizable,TRUE); n++; XtSetArg(args[n],XtNtextOptions,resizeHeight|resizeWidth); n++; XtCreateManagedWidget("msg",asciiStringWidgetClass,form,args,n); /* display */ XtPopup(popupshell,XtGrabNone);
kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) (04/20/89)
> My problem is no matter how much I tried, I could not get > AsciiStringWidget to resize to cover the text size. It insists to be > one font high and 100 pixels long (at least it appear to be so). The text widget doesn't particullarly care what size it is. In fact it aways asks to be one row high by 100 pixels wide. What you need to do is force it to be larger. A good way to do this is to put it inside a VPaned widget. If you set the maximum pane size of the label to be its current height then the VPaned widget will force the text widget to fill all remaining vertical space. Then with a geometry specification in your resource file you can specify the size of your popup widget, and from this the size of your text widget will be automatically set to take up all space not used by the label. Isn't geometry management fun :-) Chris D. Peterson MIT X Consortium
klee@daisy.UUCP (Ken Lee) (04/21/89)
In article <8904192223.AA02450@dinorah.wustl.edu> y2@DINORAH.WUSTL.EDU writes:
=>My problem is no matter how much I tried, I could not get
=>AsciiStringWidget to resize to cover the text size. It insists to be
=>one font high and 100 pixels long (at least it appear to be so).
I've had this problem, too. The workaround I used was to specify
XtNheight and XtNwidth for the text widget. Note that the font height
and 100 pixel width are the defaults for XtNheight and XtNwidth.
--
Ken Lee
Daisy Systems Corp., Interactive Graphics Tools Dept.
Internet and Smail: klee@daisy.uucp
uucp: uunet!daisy!klee