Command buttons on flowchart objects?


#1

Our app uses a flowchart like this:
http://www.voiceguide.com/images/wndGsdAhService1.gif
each flowchart object has command button on it - and when clicked extra info about that object is listed. Can we use your product to replicate this?
Each object can alos have it’s title and text description edited - is this possible with your product as well?


#2

You might want to add a GoButton object to your composed object.
Then you could get the click-event by using
GoButton.OnSingleClick();
Should be no problem I guess.

Even the text-editor should be possible.
Use something like this to override the default-behaviour:

public override GoControl CreateEditor(GoView view) {
GoControl editor = new GoControl();
editor.ControlType = typeof(RichTextBoxControl);
// make somewhat bigger, for a border
RectangleF rect = this.Bounds;
rect.X -= 2;
rect.Y -= 2;
rect.Width += 4 + SystemInformation.VerticalScrollBarWidth*view.DocScale;
rect.Height += 4;
editor.Bounds = rect;
return editor;
}

public override GoControl Editor {
get { return myEditor; }
}

Maybe walter wants to correct me. :-)


#3

It isn’t clear how many ports there are supposed to be, and whether the connection points must remain fixed.
The easiest thing to do is to use a GoBoxNode with a very thin Margin and whose Body is a GoGroup that you create. You’ll need to Add various objects to the GoGroup, with the desired sizes and positions, including a GoButton in the top-right corner.
Do you really want the scroll bars? It would be easiest to use a GoText object whose AutoResizes property is false. You can set the GoText.StringTrimming property appropriately too.
If you really want a rich text control, I suggest you use the example code in Demo1.


#4


[Serializable]
public class InfoNode : GoBoxNode {
public InfoNode() {
this.Resizable = false;
this.Reshapable = false;
this.PortBorderMargin = new SizeF(0, 0);
this.Port.Brush = Brushes.White;
this.Port.Pen = Pens.Black;
((GoBoxPort)this.Port).LinkPointsSpread = true;
GoGroup infog = new GoGroup();
infog.Selectable = false;
GoRectangle infor = new GoRectangle();
infor.Selectable = false;
infor.Brush = Brushes.LightGray;
infor.Bounds = new RectangleF(0, 0, 150, 20);
infog.Add(infor);

GoText infot1 = new GoText();
infot1.Selectable = false;
infot1.AutoResizes = false;
infot1.StringTrimming = StringTrimming.EllipsisWord;
infot1.Text = “Welcome”;
infot1.Bounds = new RectangleF(3, 3, 126, 14);
infog.Add(infot1);

GoButton infob = new GoButton();
infob.Selectable = false;
infob.Label = null;
GoImage infoi = new GoImage();
infoi.Name = “star.gif”;
infob.Icon = infoi;
infob.Bounds = new RectangleF(132, 2, 16, 16);
infog.Add(infob);
infob.Action += new GoInputEventHandler(button_Action);
myButton = infob;
GoText infot2 = new GoText();
infot2.Selectable = false;
infot2.Wrapping = true;
infot2.Multiline = true;
infot2.AutoResizes = false;
infot2.Editable = true;
infot2.StringTrimming = StringTrimming.EllipsisWord;
infot2.TransparentBackground = false;
infot2.Text = “Hello there!”;
infot2.Bounds = new RectangleF(3, 23, 144, 44);
infot2.WrappingWidth = infot2.Width;
infog.Add(infot2);
myMessage = infot2;
this.Body = infog;
}
protected override void CopyChildren(GoGroup newgroup, GoCopyDictionary env) {
base.CopyChildren(newgroup, env);
InfoNode n = (InfoNode)newgroup;
n.myMessage = (GoText)env[myMessage];
// button’s Action event handler is not copied
n.myButton = (GoButton)env[myButton];
if (n.myButton != null) {
n.myButton.Action += new GoInputEventHandler(n.button_Action);
}
}
private void button_Action(object sender, GoInputEventArgs e) {
MessageBox.Show("clicked button of " + this.Text);
}
public String Message {
get { if (myMessage != null) return myMessage.Text; else return “”; }
set { if (myMessage != null) myMessage.Text = value; }
}
private GoButton myButton = null;
private GoText myMessage = null;
}