Hi all,
Can anybody show me how to modify control + drag behaviour. I want drag and control drag both just move the object.
Thanks
Hi all,
Can anybody show me how to modify control + drag behaviour. I want drag and control drag both just move the object.
Thanks
If you don’t want to allow objects to be copied in that GoView, you can set GoView.AllowCopy to false. However, this also disables GoView.EditCopy (aka Control-C). Setting GoDocument.AllowCopy to false has this effect for all GoViews displaying that document.
Thanks for the answer,
I follow your instructions. It turns out that the copy function is disable but I cannot move the object using Ctrl + Drag.
I want Ctrl + Drag = Drag = Just move object over a GoView
If you replace the standard GoToolDragging tool with the one I show above, both unmodified and modified (i.e. Ctrl) drag will only move the selection.
I checked again I did exactly as you told. The result is just the same like if we set AllowCopy = false !!
Get lost !!
In my GoView class, i also override EditCopy() and it do nothing.
Sorry, It’s working but not so nicely.
What really happened is:
You Press the Ctrl while dragging an object. Release the ctrl then the mouse, the object will move.
What I would like to have is : Press the Ctrl while dragging an object. Release the mouse then the object will move. It should be indentical to unmodified drag.
I’m sorry, but I am unable to reproduce the behavior that you see.
Hi, the below is my example for you:
using Northwoods.Go;
using System.Windows.Forms;
using System.Drawing;
using WindowsApplication8;
public class MinimalApp : Form
{
// constructor
public MinimalApp()
{
this.Text = “Minimal GoDiagram app”;
// create a Go view (a Control) and add to the form
GoView myView = new GoView();
myView.ReplaceMouseTool(typeof(GoToolDragging), new NotCopyDraggingTool(myView));
myView.Bounds = this.ClientRectangle;
this.Controls.Add(myView);
// create two nodes for fun...
GoBasicNode node1 = new GoBasicNode();
// specify position, label and color
node1.Location = new PointF(100, 100);
node1.Text = "first";
node1.Label.Editable = true;
node1.Brush = new SolidBrush(Color.Blue);
// add to the document, not to the view
myView.Document.Add(node1);
GoBasicNode node2 = new GoBasicNode();
node2.Location = new PointF(200, 100);
node2.Text = "second";
node2.Label.Editable = true;
node2.Brush = new SolidBrush(Color.Magenta);
myView.Document.Add(node2);
}
public static void Main(string[] args)
{
Application.Run(new MinimalApp());
}
}
Here is the new dragging tool
using System;
using Northwoods.Go;
namespace WindowsApplication8
{
/// <summary>
/// This class prevent Ctrl + Drag in GoView from copying object
/// </summary>
[Serializable]
public class NotCopyDraggingTool : GoToolDragging
{
public NotCopyDraggingTool(GoView v) : base(v) {}
public override bool MayBeCopying() { return false; }
}
}
Ah, you must have an old version of GoDiagram. Add the following override to NotCopyDraggingTool: