gjf00@duts.ccc.amdahl.com (Gordon Freedman) (04/30/91)
Does anybody know how request or force a window to resize itself to something sensible after changing the layout of some of the widgets in the window? I have a window with two rowcols in it. They start out with XmNpacking set to PACK_TIGHT, but I want to be able to change to PACK_COLUMN with 2 for XmNnumColumns. I defined a callback for a toggle button to toggle between the two states. In the callback, I set XmNpacking for the two rowcols. Unfortunately, I can't figure out how to get the window to resize itself. I don't want to have to figure out how big the window should be and use something like XtResizeWidget. I don't explicitly specify any sizes at all for the widgets in the window, Motif (or Xt or X) does the right thing based on attachments and number of characters/columns/etc, so I don't get involved at all trying to figure out the size of any widgets/forms/windows when creating and realizing the window and its widgets. I have tried many things, such as unmanaging and remanaging all of the widgets from the rowcols on up to the main window (just under the top level shell), and unrealizing and then realizing the top level. All this does is make the window flash funny, and then make the user have to resposition the window. The rowcols change from one column to two (from TIGHT to COLUMN) and vice versa, but the window size stays the same. Note that the rowcols shrink vertically when going from PACK_TIGHT to PACK_COLUMN, but grow horizontally. They do the opposite when going the other way. Any help would be greatly apreciated. Thanks in advance. -- Gordon Freedman: gjf00@duts.ccc.amdahl.com Disclaimer: My opinions! Not my employers!
berlage@gmdzi.gmd.de (Thomas Berlage) (05/02/91)
In article <33iu02bN07Of01@JUTS.ccc.amdahl.com>, gjf00@duts.ccc.amdahl.com (Gordon Freedman) writes: > Does anybody know how request or force a window to resize itself to something > sensible after changing the layout of some of the widgets in the window? Whether resizing is allowed is controlled by all manager widgets in the hierarchy. First of all you have to set XmNallowShellResize of the toplevel shell to True. Other manager widgets may have similar resources. Thomas Berlage (berlage@gmdzi.gmd.de), GMD, Germany
gjf00@duts.ccc.amdahl.com (Gordon Freedman) (05/04/91)
In article <4639@gmdzi.gmd.de> berlage@gmdzi.gmd.de (Thomas Berlage) writes: >In article <33iu02bN07Of01@JUTS.ccc.amdahl.com>, gjf00@duts.ccc.amdahl.com (Gordon Freedman) writes: >> Does anybody know how request or force a window to resize itself to something >> sensible after changing the layout of some of the widgets in the window? >Whether resizing is allowed is controlled by all manager widgets in the >hierarchy. First of all you have to set XmNallowShellResize of the toplevel >shell to True. Other manager widgets may have similar resources. > >Thomas Berlage (berlage@gmdzi.gmd.de), GMD, Germany First, thanks to Thomas for the answer to my question. Experimenting with using XmNallowShellResize, I found that I only needed to specify it for the top level shell widget (which I created with XtVaAppInitialize). I was able to do a SetValues after creating the top level shell to set this. I did not have to set it for any other widgets, and the heierarchy was: ToplevelShell -> XmMainWindow -> XmFrame -> XmForm -> XmRowColumn(2) | +------> XmMenuBar -> CascadeButtons The two XmRowColumns were what I was changing the layout for, I found that if I didn't unmanage them before I changed their layout, the window got larger than it needed to, as it was resized after the first layout was changed, and then resized again after the second layout was changed. Unmanaging them and then Managing them after changing both layouts caused the toplevel shell to only resize once, which was what I wanted. -- Gordon Freedman: gjf00@duts.ccc.amdahl.com Disclaimer: My opinions! Not my employers!