GoBasicNode

Hey all,

I am looking to create a node which is a circle with a box around it (the box is not essential ). In the centre I want a text label which will contain the positional co-ordinates of the node e.g. 1,1. All nodes will be joined with links which will not be deletable by the user.

First of all, is GoBasicNode the right node to use to create this?

I am having the following problems with GoBasicNode;

  1. By default GoBasicNode has a black circle in the center. I would like this circle to be replaced by a text label.

  2. If you click and drag on the black circle the node doesn’t actually nove, instead it creates links between nodes. Is there anyway that you can stop this? I want the user to be able to move the node by grabbing it anyway (even by grabbing the centre of the node)

  3. Create a box round the circle. This is not essential however.

Many thanks,
David

  1. Set GoBasicNode.LabelSpot = GoObject.Middle.
    If you don’t want the size of the GoEllipse (which is the default GoBasicNode.Shape) to fit around the Label plus some margins, then you can set GoBasicNode.AutoResizes = false and set the Shape.Size to the size you want.
  2. That black circle is actually the GoBasicNode.Port. (The GoPort.Style is GoPortStyle.Ellipse and the GoPort.Brush is a solid black brush.)
    Set GoView.AllowsLink = false if you want to turn this off for all GoPorts in the GoView; or set GoPort.IsValidFrom and GoPort.IsValidTo to false on each port for which you want to disable user-drawn linking operations.
  3. Do something like:
    GoBasicNode n = …
    GoRectangle r = new GoRectangle();
    r.Selectable = false;
    // and maybe set the r.Pen and/or r.Brush as desired
    r.Size = n.Shape.Size;
    r.Center = n.Shape.Center;
    n.Add®;

Thanks very much!

I also would like to do two other things. I would like the inside of the nodes to be transparent, so that you can see the background.

Also when I drag a node I would like to see the node moving and all the links updating in real time. I noticed that this happened in one of the demos. When I move a node

Thanks again for the quick responce
David

  1. Set GoBasicNode.Shape.Brush = null.
  2. Set GoView.DragsRealtime = true.

Thanks again!

You have been a great help!

hi

i also tried with
Set GoBasicNode.Shape.Brush = null.
Its working fine. now that inside node is transperent .
but i want link arroe should end at outer node and not to inside node.
what is the solution for that??
thanks.

Do you mean the outer shape instead of the GoBasicNode.Shape?

Yes, just set GoBasicNode.Port.PortObject to refer to the outer shape. By default it refers to the GoBasicNode.Shape.
By the way, you can rearrange the Z-order of the shapes in any group (including all nodes). In this case you might want the additional bigger shape to be "behind" the standard GoBasicNode.Shape. You can do that by using one of the GoGroup.Insert... methods.

I mean currently link is pointing to port and i want link should point to node.
as port is inside the node and it is transperent that link is pointing to center of node…instead i want that should point to that ellipse’s edge.