klee@daisy.UUCP (Ken Lee) (04/27/89)
I'm creating a general purpose alert box that I can popup to inform users of important news. I tried using a Athena dialog widget (inside a transient shell). Unfortunately, I got segmentation faults (in the intrinsics) when I tried to XtSetValues the XtNlabel on the dialog widget. I redid it using a label and command widgets in a form. That worked fine, except that the label widget doesn't resize, even though I have XtNresize set to True. I'm using X11R3 on a Sun 386i, SunOS 4.0.1. Are these bugs? Anyone know how to work around them? Thanks much. Also, the transient shell widget seems to set override redirect. My window manager (TWM) completely ignores it. I can work around this using a WM shell. -- Ken Lee Daisy Systems Corp., Interactive Graphics Tools Dept. Internet and Smail: klee@daisy.uucp uucp: uunet!daisy!klee
kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) (04/27/89)
> I'm creating a general purpose alert box that I can popup to inform > users of important news. I tried using a Athena dialog widget (inside a > transient shell). Unfortunately, I got segmentation faults (in the > intrinsics) when I tried to XtSetValues the XtNlabel on the dialog widget. This is known bug. With a one-line fix. In Dialog.c in the Function SetValues: Change the line: XtSetArg( args[1], XtNlabel, w->dialog.label ); To: XtSetArg( args[0], XtNlabel, w->dialog.label ); > I redid it using a label and command widgets in a form. That worked > fine, except that the label widget doesn't resize, even though I have > XtNresize set to True. The resize resource is used for the label to know whether or not to automatically resize itself when its lable is changed. This resource will have no effect in this case. You need to Chain the edges of the label to the form so that when the form resizes the label will resize also. I posted a description of how the form widget works a while ago, I guess it is time to post it again. I will include it at the end if this message. > Also, the transient shell widget seems to set override redirect. My > window manager (TWM) completely ignores it. I can work around this > using a WM shell. Nope, it sets the TRANSIENT_FOR property. Chris D. Peterson MIT X Consortium ----- repost of message on using the Form widget. ------ The form widget is a slippery character and is difficult to describe and understand, we are looking into getting something better, but for a while for doing general widget layout the form is it. So to let people use it more effectively I will try to give a better explanation of its use. The form has two distinct methods of laying itself out. Method 1 never resizes the children of the form, and just attempts to place them in next to each other like building blocks, according to the resources shown below. The FromVert resource is used to place this widget directly below one of its siblings. The fromHoriz resource is used to place this widget directly to the right of one of its siblings. This method is used when managing and unmanaging children, and processing childrens geometry requests. Method 2 may resize children if the XtNresizable constraint resouce is set for that child. This method takes each edge of each child, and moves it appropriately, for instance in the above example you may want to chain both the top and bottom edges of the lable widget to the top of the form. This will of course keep it from changing size, and both edges are fixed to the top of the form. For really strange behavior you can chain the top of a widget to the bottom of the form, and the bottom of a widget to the top of the form. This method is only used when the form is told to resize itself by its parent. Resources for each method of laying out the form widgets children. Method 1 Method 2 -------------------------------------------------------------- XtNfromVert XtNbottom XtNfromHoriz XtNtop XtNhorizDistance XtNleft XtNvertDistance XtNright XtNresizeable Back to the specific question: The only what to get the label widget to go all the way across the form like you are asking is to size it appropriately. This can be done by querying the daughter form widgets of their sizes (a call to XtFormDoLayout may be necessary) and the label widget of its XtNhorizDistance resource, and adding them all together as the correct size of the label widget. Chris D. Peterson MIT X Consortium
klee@daisy.UUCP (Ken Lee) (04/28/89)
In article <8904271552.AA02836@expo.lcs.mit.edu> kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) writes: >> I redid it using a label and command widgets in a form. That worked >> fine, except that the label widget doesn't resize, even though I have >> XtNresize set to True. > >The resize resource is used for the label to know whether or not to >automatically resize itself when its lable is changed. This resource >will have no effect in this case. Actually, the behaviour I'm seeking is resizing the label widget when the label text is changed. I changed the label to a large one (more characters), but the label widget remained the same size, clipping off the characters at the end of my new string. I'm using the variable font. Does that make a difference? Thanks for the other info! -- Ken Lee Daisy Systems Corp., Interactive Graphics Tools Dept. Internet and Smail: klee@daisy.uucp uucp: uunet!daisy!klee
kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) (04/28/89)
> I redid it using a label and command widgets in a form. That worked > fine, except that the label widget doesn't resize... > Actually, the behaviour I'm seeking is resizing the label widget when the > label text is changed. I changed the label to a large one (more > characters), but the label widget remained the same size. The problem is that the Form is denying geometry requests from the label. This is sometimes very useful, but not what you want. There is a constraint resource in the Form widget called XtNresizable. Set it to TRUE. Chris