GoGeneralNode Question

I have few questions on GoGeneralNode. I am working on protoapp sample to get some knowledge on Go components.

In protoapp, GraphNode.cs class inherits from GoSimpleNode.I changed the class so that it inherits from GoGeneralNode and overrided the following methods.

1) public override void Initialize(ResourceManager res, string iconname, string top, string bottom, int numinports, int numoutports)

2)public override void Initialize(ImageList imglist, int imgindex, string top, string bottom, int numinports, int numoutports)

3)protected override GoText CreateLabel(bool top, string name)

4) protected override GoGeneralNodePort CreatePort(bool input)

Now the question is

1) when I pass “null” in place of icon Name to initialize method,Gogeneral node producing a rectangle.Is there any way that I can change the shape of that?like Rhombous,Rounded rectangle etc.,One way I tried is creating my own shape and adding it to GoGeneralNode.But in this approach I need to create shapes and ports etc.Instead do we have any style kind of property for GoGeneralNode where I can use it to produce the kind of shape that I need?

2) How can I edit the display text of the Node ( top or bottom text)?

3) By default GoGeneral Node creates port numbers as 0,1,2,3… etc.,Can you please direct me to some KB articles where we can customize the display text of the ports? Probabbly different port display text for different node ports ( more useful ).


Rami Reddy

  1. I’m not sure why you overrode Initialize, but both methods normally call CreateIcon to create the image. When the name (for the override that takes the String iconname) is null, CreateIcon returns a GoRectangle. You can substitute your own objects, including returning a GoGroup that contains several GoObjects.
  2. Set GoText.Editable to true on the TopLabel and the BottomLabel, and users can modify the text using an in-place editor associated with the GoText object. Or are you just asking how to change the text? Set GoText.Text. But you already override CreateLabel (again, I’m not sure why) so you could just do it in your override method.
  3. I would override MakePort to call the base method first, and then set the Text property of the resulting GoGeneralNodePort.Label.