GoOverview rescale to fit

Hello there,



How can I get a derived instance of GoOverview to automatically rescale to fit as the underlying document changes? It seems strange to me that an overview window does not do this by default? An overview window is not really much benefit to the user if it has to be scrolled around in the same manner as a larger view…?



Kind regards,



Ben Bourner

I haven’t tried this, but I would think you can just define a GoDocument.Changed event handler that detects the GoDocument.ChangedSize hint (and maybe the GoDocument.ChangedTopLeft hint) and calls RescaleToFit on the overview.
You say you already have a subclass of GoOverview? Then you can just override OnDocumentChanged to do this, instead of adding a delegate to the overview’s document’s Changed event.

Here’s all the events I’m handling, NONE of which seem to pick up any doc size changed event. This is incredibly frustrating, what am i doing wrong?



o.Observed.Document.Changed+=new Northwoods.Go.GoChangedEventHandler(o_DocumentChanged);

o.DocumentChanged+=new Northwoods.Go.GoChangedEventHandler(o_DocumentChanged);

o.Observed.ObjectResized+=new Northwoods.Go.GoSelectionEventHandler(Observed_ObjectResized );

o.Observed.Resize+=new EventHandler(Observed_Resize);

o.Observed.PropertyChanged+=new PropertyChangedEventHandler(Observed_PropertyChanged);

I just tried this, and it worked as I expected, which I believe is what you want. You also might want to remove the scrollbars by setting goOverview1.ShowVerticalScrollBar and .ShowHorizontalScrollBar to GoViewScrollBarVisibility.Hide goOverview1.Observed = goView1; goView1.Document.Changed += new GoChangedEventHandler(goView1_DocumentChanged); . . . protected void goView1_DocumentChanged(Object sender, GoChangedEventArgs evt) { if (evt.Hint == GoDocument.ChangedTopLeft) { goOverview1.RescaleToFit(); } else if (evt.Hint == GoDocument.ChangedSize) { goOverview1.RescaleToFit(); } }

Thanks for the info Walter, I implemented this but I am still having an
issue with the overview. The user can still resize it by clicking
on it, holding Ctrl and turning the mouse wheel. I’ve tried the
following:
goOverview1.AllowResize = false;
goOverview1.Document.AllowResize = false;
goOverview1.Observed.AllowResize = false;
goOverview1.Observed.Document.AllowResize = false;

None seem to work. Any suggestions?

Mike

AllowResize controls whether the user can resize any object. It doesn’t have anything to do with scaling/zooming a GoView.
You can disable mouse actions of all kinds by setting goOverview1.AllowMouse = false.
If you just want to disable scroll wheel events, then it’s probably easiest to install as the GoView.DefaultTool an instance of a subclass of GoToolManager that overrides GoTool.DoMouseWheel() to be a no-op.