Q: How to determine the width of a document?

Bruno Essmann (bessmann@iiic.ethz.ch)
Fri, 26 Jul 1996 09:05:38 +0200

For a container view that handles the height of the document itself (and thus
answers the messages "Controllers.PollSectionMsg", "Controllers.ScrollMsg",
"Controllers.PageMsg" and "Properties.BoundsPref") I have the following
question:

In the "aView.HandlePropMsg" procedure the "Properties.BoundsPref" message is
answered. Since the view handles the height itself it can calculate the height
but *not* the width of the view. The width of the view should always be the
width of a document, i.e. the "Properties.ResizePref" message is answered with
"aProp.horFitToPage := TRUE".

In my first attempt I didn't modify the width of the "Properties.BoundsPref"
message record (which is predefined to "Views.undefined"). This caused the
OLE server of Oberon/F to hang if the view was pasted in another application.

The second attempt also caused the Oberon/F OLE server to hang. Here I tried
to get the size of the document by calling "aView.context.GetSize(w, h)".

Since I don't know how to get the correct width of the view I'm currently
setting the width to a fixed value (which is of course not correct since the
width of the document changes by changing the page setup).

I noticed that if a text view is inserted as OLE document then the view is
also inserted with an incorrect fixed width which causes the text to be
reformatted.

Does anybody know how to calculate the size of a document when answering a
"Properties.BoundsPref" message?

Cheers,
Bruno

PS: I've also tried to calculate the size using the current printer but since
there's no documentation for "Printers" I've only been able to find out that
"Printers.dir.Current()" has boundaries (l,r,t,b) of the printer page but I
haven't been able to calculate the margins that are used when printing (one
could use "HostDialog.setup.left", etc. but that doesn't seem to be correct).