Document and view xy arithmetic


#1

The situation is, I have an autohide tray area at the bottom of the view, and so when an object is dragged past that Y coordinate, the tray hides, the view should scroll and the document should increase in size if necessary, similar to what Go would do if the node were dragged past the edge of the view.
However, I have not been able to accurately calculate the difference in height between the view and document, since I can’t see a relationship. For example, when the application launches, the height of the document is 680, and the height of the view is 732. The scale being normal, I would expect them to be the same on a blank canvas, and in any case I would not have expected the view to be larger than the document.
Where is my thinking wrong here, and if my approach is not sound, how might I modify it? Advice is greatly appreciated!


#2

Documents automatically increase in size to accomodate its objects. Normally you never need to worry about it. Go ahead and position/size that tray area where you want it to be.
You can override the GoView.DocumentSize and GoView.DocumentTopLeft properties if you don’t like the default way it looks at the GoDocument’s Size and TopLeft properties.


#3


Thanks for the information Walter. My problem remains that I’m not able to correlate document size with view size. Since I have an artificial bottom edge to the view, I must increase the height of the document by the height of whatever is dragged into the tray area, if the document is not already large enough to accomodate it. In order to know that, I must calculate difference between document size and view size. Herein lies the problem, as the height of the document and the height of the view do not start out the same, and I can’t see how to normalize one to the other. Can you enlighten?


#4

I guess I still don’t understand what you want to do. Here are some things to consider:
You can just set the GoDocument.Size (and TopLeft) properties.
You could make your tray a view object instead of a document object. That way the tray won’t be part of the document and thus won’t affect the document size. But it won’t be selectable either, at least not by the usual mechanisms. [Off topic: the GoOverviewRectangle is a view object in a GoOverview, and it is the only thing that can be selected in a GoOverview.]