PDA

View Full Version : Deleting selected objects on the map??



VC_Man
02-05-2007, 02:50 AM
Lagnuage: VC++ 6.0
Version: Mappoint 2006
Type: COM/ActiveX


Hello my friends,

I think I have a difficult problem here.
When I draw a rectangle on the map, I can select the drawn rectangle and modify its size. But I can also delete it, just by pushin the delete-key on my keyboard. The problem is, how can I see in the code wether I deleted a selection?

Normally I keep track of the created objects on the map by putting them in a collection. But pressing the delete-key deletes an object without notifying me what happened. Maybe I can use the AfterViewChange event to see something has changed, but I don't know if it works. Also I don't know how to solve this problem. Anybody a suggestion? Thank you.

Winwaed
02-05-2007, 09:05 AM
When you create a shape, you can apply an identifier to it. This is only visible to your program. Then search the shapes to find it. If it is still there, then it hasn't been deleted.

Richard

Paul Larson
02-05-2007, 05:26 PM
You could also check ActiveMap.Shapes.Count before and after the deletion.

VC_Man
02-06-2007, 07:26 AM
Thank you for your replies guys,

I think the solution of Paul is much easier, because I just check the count at the delete-key message handler. I don't like to do too much coding for just checking the deleted object. But I guess there is no other options, right?

Btw, is it possible to catch the delete-key message before it arrives to Mappoint? Than I ignore it and force the user to do it accoording my way.

Wilfried
02-06-2007, 12:40 PM
Hi,

you can set the form's KeyPreview to true. I did not tryed it but with ActiveX things possible some things are not working as expected. If KeyPreview is true then all key's are trapped by the form and you can null them if nececary.

VC_Man
02-07-2007, 01:59 AM
Ok thank you Willfried,

I'll look if I can workt it out.
Thnx guys.