Problem with view.selection()


Ok, so I have discovered that when you copy/cut/paste, the objects in view.selection are not always in the same order. For my purposes they always have to be in ascending order according to their PartIDs.
So I decided to simply populate a GoCollection with MyBase.Selection and then change the order of the objects GoCollection to however I want. Then later use this GoCollection for my purposes. However, when I do this, for some reason it empties MyBase.Selection so that it no longer contains the original GoObject lists. I never write-over MyBase.Selection so I don’t understand why it is happening - any ideas?


What’s “MyBase.Selection”?
You could set a breakpoint in a GoView.ObjectLostSelection event handler, to find out when the view’s selection is being cleared out.


sorry - MyBase.Selection is referring to my GoView class - so it’s really GoView.Selection.
and the view.selection gets cleared out when I call a function from inside view.EditCopy() and pass it the GoCollection containing the view.selection. I have succesfully called functions from inside EditCopy() before without clearing out the view.selection, however, in those instances I was passing an object only, not a GoSelection or a GoCollection. Do you have any ideas how I can work around this situation?


GoView.EditCopy doesn’t change the GoView.Selection. It calls GoView.CopyToClipboard to make a copy of the selection in a new document.
So if you have overridden some method to change the selection during a call to GoView.EditCopy, you need to change your code.


Here is what I am trying to do:
I am overriding EditCopy() in my GoView class. Inside this class I do the following:
Dim col as GoCollection = New GoCollection
col = MyBase.Selection
col = Get_Selection(col)
“Get_Selection” is simply a function I created in the GoView class to take the collection passed to it, loop through all the objects it contains and place the objects in ascending order according to their PartIDs in a new GoCollection. This new GoCollection is then passed to the calling function, which in this case is the EditCopy() sub.
When I call the “Get_Selection” function inside the EditCopy() sub in my GoView class, it calls the OnObjectLostSelection sub and so GoView.Selection is cleared. I do not want to clear the contents of GoView.Selection, I simply want to use its contents for other purposes when the EditCopy() sub is called.
Does it make sense now?


Why do:
col = MyBase.Selection
after doing:
Dim col as GoCollection = New GoCollection
Anyway, you must be modifying the GoView’s Selection, either in your Get_Selection method, or in the (unposted) rest of your EditCopy override method.