Problem with newdrawing (4.8.8) Urgent

Feb 4, 2015 at 9:01 PM
Hi

I want to use several drawing layers to add small circles around symbols. So I create those drawing layers like this
                With WinMap1
                    rubLayer = .NewDrawing(MapWinGIS.tkDrawReferenceList.dlSpatiallyReferencedList)
                    selLayer = .NewDrawing(MapWinGIS.tkDrawReferenceList.dlSpatiallyReferencedList)
                    snapLayer = .NewDrawing(MapWinGIS.tkDrawReferenceList.dlSpatiallyReferencedList)
                    gpsLayer = .NewDrawing(MapWinGIS.tkDrawReferenceList.dlSpatiallyReferencedList)
                    okLayer = .NewDrawing(MapWinGIS.tkDrawReferenceList.dlSpatiallyReferencedList)
                End With
At this moment, handles will get the value 0, 1, 2, 3...

Then if I want to clear a layer, I use winmap1.cleardrawing(oklayer). At this moment, oklayer = 4 (fourth declared)

the problem comes here, when I recreate the erased layer
oklayer=winamp1.NewDrawing(MapWinGIS.tkDrawReferenceList.dlSpatiallyReferencedList)

here oklayer= 0 ! Which was the handle of rublayer...

I expected .newdrawing to return a non used handle.

Thanks for any help as I'm stuck...

Olivier
Feb 4, 2015 at 9:18 PM
Edited Feb 4, 2015 at 9:25 PM
Forget it I think it's a problem in my code. To explain, it's necessary to add a x=.newdrawing after each .cleardrawing.(x) to keep the same value for x Otherwise the handle becomes free and is reused.
Marked as answer by sleschinski on 2/4/2015 at 1:22 PM