Community of VE/MapPoint Users and Developers
This is a discussion on deleting shapes within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Hi, Using vb5/activexMP2006 In a sub I add a shape based on passed lat and lon parameters. Works fine. private ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| deleting shapes Using vb5/activexMP2006 In a sub I add a shape based on passed lat and lon parameters. Works fine. private objmap as mappointctl.map private objloc(1 to 3) as mappointctl.location sub pasteshape( lat as single, lon as single) Set objLoc(1) = objmap.getlocation(lat,lon,10) objmap.shapes.addshape geoShapeOval, objLoc(1), .05 objmap,shapes.item(1).line.forecolor = vbred end sub However I am unable to create a sub which will delete this shape as the above subs object references are now out of scope. Does anyone have an alternate method of creating/deleting shapes? Thanks, bartj |
| ||||
| Re: deleting shapes
You need to give the shape a unique name. Then when you want to delete, it you have to manually search through the shapes until you find the shape with the name you want to delete. Then delete it. Richard
__________________ Winwaed Software Technology LLC http://www.winwaed.com See http://www.mapping-tools.com for MapPoint Tools Pre-Order MapPoint 2009 today: http://www.mapping-tools.com/mappoint2009 |
| |||
| Re: deleting shapes
Hi, the AddShape method returns a shape object. You can declare a static or global varialbe that holds the object, or an array if you have many. Then you can use Delete method to delete individually.
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
| Re: deleting shapes
Wilfried, Finally getting back to this.....am unsure how the AddShape method returns a shape object? I tried: Public objMapy As MapPointCtl.Map Public objLocy As MapPointCtl.Location Sub PlaceShapey(itemnumber As Long, lat As Single, lon As Single, color As Long) Static z As Object Set objMapy = frmmap.MappointControl1.ActiveMap Set objLocy = objMapy.GetLocation(lat, lon, alt) ' draw circle z = objMapy.Shapes.AddShape(geoShapeOval, objLocy, 0.3, 0.3) ' define shape parameters objMapy.Shapes.Item(itemnumber).Line.ForeColor = color objMapy.Shapes.Item(itemnumber).Line.Weight = 4 objMapy.Shapes.Item(itemnumber).Fill.ForeColor = color objMapy.Shapes.Item(itemnumber).Fill.Visible = True End Sub But I get: Object variable not set error. Function works if I remove the "z = ". Other strange behaviour: If I also use the following delete function: Sub hideemy(itemnumber As Long) On Error GoTo eh objMapy.Shapes.Item(itemnumber).Delete Exit Sub eh: End Sub All is well if I execute these without adding any other shapes, they work fine. However if I also add some shapes using different references (not objMapy or objLocy) I find that when I call the above placeshape sub, it places a black ring in expected location when adding and does not delete when attempting to do so. I have no "vbblack" anywhere in my code. Any comments or insights? Thanks, Bart |
| |||
| Re: deleting shapes
Hi Bart, I think you have to define: static z as Shape; For you second question I'm not sure why there is an error generated. Can you check the ItemNumber? Remember that all indexes in Mappoint start at 1 instead of 0.
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
| Re: deleting shapes
Wilfried, Thanks for the response. I have solved the "problem". I was initially adding say 99 shapes based on 99 defined locations. If I then added a 100th shape at a 100th location all was fine, but when I attempted to delete the 100th shape the ring would appear. I was using an index of 100 to delete the shape. However I found that if I instead used an index of 1 the ring did not appear. If I then move shape and location 100 to another position(after the shape being deleted) the shape is again shown correctly and again, I need to use index 1 to delete it. I guess the delete is based on a "most recent" basis which is a bit counter intuitive. Again, thanks for your help and suggestions, Bart |
![]() |
| ||||
| Posted By | For | Type | Date | |
| Reverse Geocoding, Pt. III - MapPoint Articles - MP2K Magazine | This thread | Refback | 07-02-2008 06:36 AM | |
| The Magazine for MapPoint - MP2K Magazine | This thread | Refback | 07-01-2008 10:14 PM | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Deleting pushpins | BobFromBoston | MapPoint 2006/2009 Discussion | 5 | 02-20-2008 11:54 AM |
| Deleting pushpins in bulk | brianmcg | MapPoint 2006/2009 Discussion | 1 | 06-22-2006 01:08 PM |
| Deleting all CShape in CShapes | discostu | MapPoint 2006/2009 Discussion | 3 | 05-17-2005 12:46 PM |
| Selecting and deleting the push pin | Anonymous | MapPoint 2006/2009 Discussion | 1 | 02-10-2005 07:01 AM |
| New map (Deleting) | Anonymous | MapPoint 2006/2009 Discussion | 0 | 07-21-2004 03:21 AM |
Flights from East Midlands Airport
Book low cost airline flights from East Midlands Airport. Holiday Hypermarket let you search for great deals from top tour operators.
Cruise Travel Agent
Book your cruise with Travel Counsellors. We are an award winning travel agent and can help plan your perfect cruise.
Cheap Holidays to Turkey
If you’re looking for cheap holidays to Turkey then dealchecker.co.uk is the place for you! Our search helps you see real prices from the UK’s top holiday companies all in one go.
Holidays in Dubai
Holidays in Dubai are an eclectic mix of the ancient and the modern. Discover an oasis of luxury amid the Arabian desert. Book here now!
Cheap Cyprus Holidays
Finding cheap Cyprus holidays can be difficult unless you know where to look and where to book. With ulookubook.com you can conduct a simple search to find the latest holiday deals to your particular destination.
Inclusive package holidays
Choose one of the many inclusive package holidays at Travel.co.uk and save a lot of trouble and money too!
Portugal Holidays
We specialise in Portugal holidays. Visit our On The Beach website for more information.