[comp.windows.x.motif] Resizing XmDrawingArea.

martin.chavez@quorum.com (R. Martin Chavez) (03/19/91)

I have a drawingArea widget that is the workWindow of a mainWindow
widget (set via XmMainWindowSetAreas).  The mainWindow and the
drawingArea are correctly instantiated; the drawingArea is created as
the child of the mainWindow and managed.  I now want to change the size
of the drawingArea, and I'd like the mainWindow to grow automatically as
necessary.

I tried simply doing an XtSetValues on XmNwidth and XmNheight for the
drawingArea widget; the widget stayed at its old size.  Then, I tried
XtMakeResizeRequest(drawing_area, width, height, NULL, NULL); I got
an XtGeometryDone reply, but the widget still didn't increase its size.
Does anybody know what I'm doing wrong?

I can get a resize to happen by doing an XtSetValues on the mainWindow
widget itself, but it's the drawingArea child that I'd like to resize
directly, since I don't know the dimensions of the mainWindow's menuPane
and separator.

Regards,
R. Martin Chavez
Quorum Software Systems, Inc.

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

> I tried simply doing an XtSetValues on XmNwidth and XmNheight for the
> drawingArea widget; the widget stayed at its old size.  Then, I tried

Applications should be using only XtSetValues() to change geometry, so you're
on the right track. 

MainWindow passes a chunk of its geometry management off to the ScrolledWindow;
that fails depending on whether or not the parent shell can resize 
(XtNallowShellResize = True) and probably on the scrollingPolicy.

> XtMakeResizeRequest(drawing_area, width, height, NULL, NULL); I got
> an XtGeometryDone reply, but the widget still didn't increase its size.

This is a widget-private function. (And it shouldn't ever return XtGeometryDone
anyway.)

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

"Some people are born great, others have greatness thrust upon them, and others
get greatness as a graduation present." - Robin Williams on current politicians

nazgul@alfalfa.com (Kee Hinckley) (03/20/91)

> I have a drawingArea widget that is the workWindow of a mainWindow
> widget (set via XmMainWindowSetAreas).  The mainWindow and the
> drawingArea are correctly instantiated; the drawingArea is created as
> the child of the mainWindow and managed.  I now want to change the size
> of the drawingArea, and I'd like the mainWindow to grow automatically as
> necessary.
> 
> I tried simply doing an XtSetValues on XmNwidth and XmNheight for the
> drawingArea widget; the widget stayed at its old size.  Then, I tried
> XtMakeResizeRequest(drawing_area, width, height, NULL, NULL); I got
> an XtGeometryDone reply, but the widget still didn't increase its size.
> Does anybody know what I'm doing wrong?

You don't want to know.  This is based on a quick two minute skim.  I
hope I'm imagining this.  MainWindow sits there and violates half a dozen
rules in the Intrinsics.  It realizes you want something wider, so it
asks the menubar if it would mind that.  If the menubar asks to be taller
it does that (doesn't seem to look at whether it minds being wider though).
Then it calls its resize procedure.  This goes and asks all of the kids
what size they'd like to be - including your drawing area of course.
Unfortunately that's illegal, and since the drawing area probably defaults
its query_geometry method, it returns that it would like to be the size
that it currently is.  But even if it doesn't, we're still screwed.  Because
MainWindow then sizes the widget to whatever it decides is right (also illegal,
because it almost certainly isn't what was asked for).  Finally it returns
from the resize procedure and returns Yes!  Which is yet another screw up,
since we should have returned Done, since we already did the reconfigure of
the object.

As I say, this was a quick skim.  I may have missed something obvious.  If
I did someone should correct me!

Incidentally, my experience, somewhat borne out by the comments in the code,
is that main windows size to the size of their menubar unless you explicitly
set their overall sizes to something else.  Nothing else seems to affect them.

Alfalfa Software, Inc.          |       Poste:  The EMail for Unix
nazgul@alfalfa.com              |       Send Anything... Anywhere
617/646-7703 (voice/fax)        |       info@alfalfa.com

I'm not sure which upsets me more: that people are so unwilling to accept
responsibility for their own actions, or that they are so eager to regulate
everyone else's.