Reply to thread

Well, if you instanciate them within a Method (the controls) then that reference is only existing until the method returns.


But, since you add them to the Childrens node (which is a List<GuiControls> I think) you can access them from there like so Children[n] where n is the index number of the control which you wish to receive.


Be aware that this List also contains all the other controls on your page, including the ones imported from various common xmls. Because of this, I would suggest creating your own List<GuiImage> as a class member (declare outside of a method) and then add them there. This way you can get quick access.


[CODE]List<GuiImage> myThumbnails = null;


private void Foo()

{

    if(myThumbnails == null) myThumbnails = new List<GuiImage>();

    GuiImage newImage = new GuiImage(blabla here);

    myThumbnails.Add(newImage);

    Childen.Add(newImage);

}


private void Fooo()

{

    GuiImage existingImage = myThumbnails[0];

    // do somethign with the image here, like set a new filename

}[/CODE]


I really suggest you read up on OO and .NET in general :)


Top Bottom