GoIconic node and palettes

I have created a form that lets users create a node that can be added to a palette. The node is derived from GoIconic node. Once a user has created a node I then remove it from the current view and add it to a palette. The problem is I am losing the icon when the node is added to the palette. I can see the node and its size is correct but the image is not visible. I am using an ImageList and Index so I assume this is a serialization problem? I have messed around with CopyChildren but notice it isnt even called when adding to the palette. Help?

It sounds like you are not making a copy of the node that is in the GoView’s Document–you are removing an existing node and then Adding it to the GoPalette’s Document. Is that right?
That’s certainly a reasonable way to go. No serialization or copying is involved, so it can’t be serialization problem and you don’t need to override CopyChildren.
How did you initialize the node’s image? You are using an ImageList, but on what object did you specify the use of that ImageList? If you had set the GoIconicNode.Image.ImageList property or the GoImage.DefaultImageList static/shared property, it should have worked.
If you had set GoView.ImageList, you need to do so on the GoPalette too.

When you say make copy of the node, what exactly do you mean? Creating another node of the same type and copy attributes like size, etc. ?
I should have been more specific. I am actually using the MultiPortNode that derives from GoIconicNode.
And yes. I am removing an existing node which was created by the user and adding it to the palette document.
My node has an arraylist of images and the image of the node must change depending on a current state. The first image a user of the object would add is the ActiveImage and here is the property for it. This is where the node’s image get initialized.
public Image ActiveImage
{
get
{
Image i=null;
if(this.images.Count>0)
i=(Image)this.images[0];
return(i);
}
set
{
if(this.images.Count==0)
this.images.Add(value);
else
this.images[0]=value;
this.iconImageList.Images.Add(value);
this.iconImageList.ImageSize=new Size(value.Width, value.Height);

this.Initialize(this.iconImageList, 0, “”);
this.Icon.Resizable=true;
this.Icon.Reshapable=false;
this.Icon.ResizesRealtime=true;
}
}

As you can see I am taking an Image and adding it to my arraylist. Then I add it to an ImageList to be used and finally call initialize. Using this code the image disappears when moving from my Editor document to the palette. Why? From what I can see this is correctly initializing the image.
I have tried what you suggest and set the GoImage.DefaultImageList or Image.ImageList but the problem persists.
I actually solved this by creating a whole other node before I added to the palette. But now I am seeing the same problem elsewhere when reloading a document. Can you show me what I am doing wrong or how to correctly initialize the MultiPortNode’s ImageList? And how can I switch between images? I assumed it would be as easy as setting the Index of the Icon. Help?

Well, calling Initialize more than once could be causing the problem. In that code you ought to just be setting properties of the GoIconicNode.Image, which is an instance of GoImage.
Yes, changing images is as easy as setting the GoImage.Index property.
The normal usage is that there is a single ImageList that is shared by all of the nodes. You can build this ImageList dynamically, if you want, or you can just construct it once, as is typical if it comes from a resource file. If there really is just a single ImageList for all nodes in your application, then you can just assign it once to the “global variable” GoImage.DefaultImageList.
The GoImage.Image, GoImage.ImageList, and GoImage.ResourceManager values are NOT serialized when the GoImage is serialized. If they were, that would be tremendously inefficient! So IF you were copying the node, and IF you wanted each GoImage to have its own ImageList, you would need to override CopyObject to make sure the ImageList got copied appropriately. But if you are not trying to avoid sharing references in copied nodes, you don’t need to worry about it.