GoObject.View is always null

Hi walter, again i have a question. GoObject has a Property View but when i create an object via GoToolCreating the obj.View is always null. Also object.Layer.View returns null. But the object is drawn correctly in my view. How can i get the view which shows my object? I do not want to pass my view as additional information. Is it possible?
TIA
Joern

edit: I forgot to mention why i need it. I need to change Reshapable and Resizable of my GoImage class and Handles should update correctly. So i want to call obj.View.Selection.AddAllSelectionHandles().

The quick answer is “no”, it is not possible.
If you added a GoObject to a document (actually to a GoLayer that belongs to a GoDocument), then the GoObject.Document property will refer to that document and the GoObject.View property will be null.
If you added a GoObject to a view layer (i.e. to a GoLayer that belongs to a GoView), then GoObject.Document will be null and GoObject.View will be that GoView.
Please remember that there can be multiple GoViews showing the contents of a GoDocument. You cannot find “the view” that is showing a document GoObject – there might be multiple GoViews, or there might be none. However, your application ought to know which GoViews it has created, as part of a Form or through some other mechanism.

Oh, I see you have added to your original post.
Perhaps the easiest thing to do, if you really don’t know which GoViews there are, is to toggle the GoObject.Visible property twice. That should cause any selection handles to be updated in all GoViews that are displaying that GoObject. Remember that each GoView has its own Selection (i.e. collection of selected objects).

Thanks for your very fast reply :)
I tried to toggle visible twice but this unselects my object :(

Actually, your object remains selected – it just doesn’t show any selection handles once they are removed when the object is made not Visible. Not adding them back again appears to be a bug, which should be fixed as of the next baselevel of the 2.5 beta.
Well, the brute force approach is to call GoDocument.InvalidateViews(). This will repaint every view that is displaying the document.

For now brute force will do.
And i will mark it with a TODO :)
Thx for your help.