I am losing my UserObject assignment. I am using a GoToolCreatings assigned as the GoToolRubberbanding with a prototype, in the Stop() method, I assign it.
When debugging I see it in the Stop method, but if I break later and look, it is null (using watch to drill down to the document layer objects).
I set up a small test and it works fine, so I am sure it is my bug, but I was wondering if you had seen this before?
The class is derived from GoTextNode, but so was my test and that worked.
Thanks for any help.
Bob
I am able to recreate it, so I will send in the code
class MyToolCreating : GoToolCreating {
private MyNode _node;
public MyToolCreating(GoView view) : base(view) {
}
public override void Start() {
base.Start();
_node = new MyNode(this.View.Document);
this.Prototype = _node;
}
public override void Stop() {
_node.UserObject = new Class1();
System.Windows.Forms.MessageBox.Show("This is the stop method of the tool and the UserObject is " + _node.UserObject.ToString());
base.Stop();
}
}
public class Class1 { // Just a dummy class
private int _1;
public int id1 {
get { return _1; }
set { _1 = value; }
}
private int _id2;
public int ID2 {
get { return _id2; }
set { _id2 = value; }
}
private int _id3;
public int id3 {
get { return _id3; }
set { _id3 = value; }
}
}
Just an update for anyone else who might have this problem. Don’t store your prototype as a member var in the tool, use the Prototype member.
I said I had to create it in Start, which is not true. I accessed it in Stop with this code:
public override void Stop() {
MyNode node = this.Prototype as MyNode;
...
}
It had my userObject, but it seemed that I could not then set a UserFlags value, so I am doing all assignment in the start() proc.