Highlight GoIconicNode.Label on Node selection

Hi,

I have many GoIconicNode objects with overlapping associated GoIconicNode.Label objects, which represent as a GoText object for description property for corresponding GoIconicNode object.
How can associated GoIconicNode.Label object be highlighted, when corresponding GoIconicNode object is selected on mouse click?

Do you want this to be in the place of the regular selection highlight of the icon, or in addition to?

Hi,

I just want that the associated text with GoIconicNode.Label object should be highlighted means either it should be 'Bold' or it's Color should be 'Red'.

Try this:



[Serializable]

public class GoIconicNode3 : GoIconicNode {



protected override GoText CreateLabel(string name) {

GoText label = base.CreateLabel(name);

label.BackgroundColor = Color.Red;

label.BackgroundOpaqueWhenSelected = true;

return label;

}



public override GoObject SelectionObject {

get {

return this.Label;

}

}

}

Hi,

Color was changed to 'Red' with your code, but text was not appeared on above of all overlapping objects.
How can it would be displayed in front of all existing other overlapping objects, so that it would be readable?

To do that, you either need to pop the node to the top of the default layer or create a new layer on top and move the selected items to that… here’s how to do the second of those:



Do this in your initialization for the view/document:



// create a layer in front to hold selected nodes

doc.Layers.CreateNewLayerAfter(doc.Layers.Default).Identifier = “selected”;



and add this to your node class:





// Move the object to the top layer, so it is visible to the user.

public override void OnGotSelection(GoSelection selection) {

this.Document.Layers.Top.Add(this);

base.OnGotSelection(selection);

}



// Move the object to the regular layer, where it can be obscured by selected nodes,

// unless this node is being deleted.

public override void OnLostSelection(GoSelection selection) {

if (!this.BeingRemoved)

this.Document.DefaultLayer.Add(this);

base.OnLostSelection(selection);

}



Hi Jake,

Thanks for all your support.
Now it works perfect.