Zooming in Goview but not in GoPalette

My Form application holds one GoPalette and one GoView. I am trying to allow Zooming in the view, but not in the palette.
First I thought that replacing the GoToolZooming in the palette would be enough, but that didn’t help at all.
Next I tried to set the Tool and DefaultTool in GoPalette to the new NeverZoomToolManager like the code below, but then I couldn’t drag and drop any more.

public class NeverZoomToolManager: GoToolManager
{
public NoZoomToolManager(GoView view) : base(view) { }

public override void DoMouseWheel()
{
if (this.LastInput.Control)
return;
base.DoMouseWheel();
}
}

In other words I want zooming in the view, but not in the palette. Yet, I still want to be able to drag&drop objects from the palette to the view. What would you recommend?

See this note.

Yes, I did exactly that a few days ago and it worked only partly. After I implemented an override for OnMouseWheel in the GoToolManager I couldn’t use the mouse wheel, but I also couldn’t select objects, couldn’t draw links and couldn’t drag and drop objects or selections from the palette into the view.

The approach discussed in your link has two drawbacks which made me ask for advice in the first place. I don’t want to disable the mouse wheel in the palette itself, I just want to disable zooming in it, but still be able to do drag & drop operations, e.g. drag objects from the palette into the view.

There’s no reason that should happen. Make sure your activation of the tool was right.



goView1.Tool = goView1.DefaultTool = new ToolManagerNoZoom(goView1);



(I went back and re-tested it… it works for me, and I can link/drag, etc)

In the constructor of my view I am using exactly these two lines

public MyView() {
this.Tool = new ToolmanagerNoZoom(this);
this.DefaultTool = this.Tool;
}

and yes I can still drag&drop from the palette to the view, but zooming was disabled for the view, not for the palette. This is not what I want.

Jake, have a GoPalette and a GoView on your form next to each other. Consider the palette read-only once you added content to it. All operations are made in the view, including dragging and dropping objects (or selections of objects) from the palette into the view. Zooming must be able in the view only, not in the palette. However, the user must nevertheless be able to scroll in the palette if the content is larger than the visable area of the palette.

The view should not be limited in it any user operating ability (adding, deleting, linking, relinking, dragging, dropping, moving selections around, subgraphs etc.). The palette on the other hand must be limited to only allow dragging objects outside of its border to drop into the view.

Can you follow me?

You don’t want this code in your MyView constructor. There are a separate set of tools for each GoView. Your palette is also a GoView. You want to put the NoZoom tool on the palette.



I did mislead a bit above… better sample code would be:



goPalView1.Tool = goPalView1.DefaultTool = new ToolManagerNoZoom(goPalView1);

Right, I was wondering why you wanted me to set the Tool and DefaultTool on the view instead on the palette. On the other hand I wasn’t aware that the palette was a view itself.

But it works as I want it to, so thanks again!