MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




How to make shapes unmoveable ?

This is a discussion on How to make shapes unmoveable ? within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Hi, As shapes that are programmatically added can be moved by the user with the mouse, I wonder if it ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-11-2005
Junior Member
Yellow Belt
 
Join Date: Jan 2005
Posts: 21
How to make shapes unmoveable ?

Hi, As shapes that are programmatically added can be moved by the user with the mouse, I wonder if it is possible to ice the shapes so that the user cannot move it ?

Do you know if that is possible and how ? (without having to copy/paste the map on a picturebox )
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 01-11-2005
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,055
Hi,

Yes it sure is possible. On this forum you find an article how to make pushpins inmoveable. Same trick could be used for shapes I suppose. http://www.mp2kmag.com/a97--pushpins....mappoint.html Check also what has been discussed here: http://www.mp2kmag.com/mappoint/disc...pic.asp?t=4315
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 01-11-2005
Junior Member
Yellow Belt
 
Join Date: Jan 2005
Posts: 21
Thanks. I've taken a look at these threads and they are interesting.

In order to prevent the user from moving pushpins and shapes I've tried the following code but I alway get a "Stack Overflow" error from the C# runtime :

Code:
		private void axMappointControl1_SelectionChange(object sender, AxMapPoint._IMappointCtrlEvents_SelectionChangeEvent e)
		{
// I don't cast anything here because I consider any selection to be a shape or pushpin
			MapPoint.Shape sp;
			MapPoint.Location loc;
			try
			{
				loc = axMappointControl1.ActiveMap.GetLocation(80,0,0);
				sp = axMappointControl1.ActiveMap.Shapes.AddShape(MapPoint.GeoAutoShapeType.geoShapeRectangle,loc,1,1);
				sp.Select();
				sp.Delete();
			}
			catch(Exception)
			{

			}
		}



the error is :
An unhandled exception of type 'System.StackOverflowException' occurred in axinterop.mappoint.dll
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 01-11-2005
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,055
Hi,

Code:
sp.Select();
This is the quilty one When Select is called the while function will be re-entered, again and again until the stack flows over

You have to set a busy flag on entering the function an first check if it is true, if true then exit. When the function exit you set the flag again to false.

Do not put the flag on the stack.

something like this will do:

Code:
            if (!select_change_busy) {
                select_change_busy = true;
                // here the code
                select_change_busy = false;
            }
In the article it was with the mousebutton I think. But it is similar.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 01-11-2005
Junior Member
Yellow Belt
 
Join Date: Jan 2005
Posts: 21
Great !!!! Thank you mister Wilfried !!!

Let's share this wonderful tip :

Code:
		bool select_change_busy = false;
		
		private void axMappointControl1_SelectionChange(object sender, AxMapPoint._IMappointCtrlEvents_SelectionChangeEvent e)
		{
			if (!select_change_busy)
			{
				select_change_busy=true;
				MapPoint.Shape sp;
				MapPoint.Location loc;

				try
				{
					loc = axMappointControl1.ActiveMap.GetLocation(80,0,0);
					sp = axMappointControl1.ActiveMap.Shapes.AddShape(MapPoint.GeoAutoShapeType.geoShapeRectangle,loc,1,1);
					sp.Select();
					sp.Delete();
				}
				catch(Exception)
				{

				}

				select_change_busy=false;
			}
		}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6 (permalink)  
Old 01-11-2005
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,055
Hi Jaba,

Thanks for the feedback. Doing so other can benefit from it also

Tip: You can put code between tags, then it is nice formatted and ident
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7 (permalink)  
Old 01-12-2005
Junior Member
Yellow Belt
 
Join Date: Jan 2005
Posts: 21
Hi Wilfried...

You're welcome

Now I want to deactivate the moving of shapes only, because with the source code above this also deactivates the viewing of pushpins' labels

I've tried the following to deactivate the moving of shapes only but I can't understand why it does not work as I would like it to ?

Code:
		bool select_change_busy = false;
		private void axMappointControl1_SelectionChange(object sender, AxMapPoint._IMappointCtrlEvents_SelectionChangeEvent e)
		{
			if (!select_change_busy)
			{
				select_change_busy=true;
				MapPoint.Shape sp;
				MapPoint.Location loc;
				MapPoint.Shape sp2;

				try
				{
					sp2 = (MapPoint.Shape) e.pNewSelection;
					loc = axMappointControl1.ActiveMap.GetLocation(80,0,0);
					sp = axMappointControl1.ActiveMap.Shapes.AddShape(MapPoint.GeoAutoShapeType.geoShapeRectangle,loc,1,1);
					sp.Select();
					sp.Delete();
					sp2=null;
				}
				catch(Exception)
				{
				}

				select_change_busy=false;
			}
		}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Make shorter a GeoBalloonState clavijo MapPoint 2006/2009 Discussion 2 08-03-2004 01:31 AM
$$$ Will Pay for A Way to Make a Map $$$ webdbx MapPoint 2006/2009 Discussion 4 07-28-2004 07:38 AM
How to make invisible a pushpin clavijo MapPoint 2006/2009 Discussion 2 07-09-2004 06:41 AM
Make New own baseMap Anonymous MapPoint 2006/2009 Discussion 1 12-03-2003 09:02 AM
trying to make a 'locator map' Anonymous MapPoint 2006/2009 Discussion 0 04-09-2003 03:37 PM


All times are GMT -5. The time now is 03:49 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
MP2K Magazine
Visitor Map

Skiing in France
Skiing in France is varies hugely from place to place and is suitable for all skiers. Using a range of leading tour operators, Holiday Hypermarket can help you find cheap holidays.

European City Breaks
Book European city breaks with Travel Counsellors. A personal travel counselor will help plan your European city break.

Cheap Flight Canada
Making a cheap flight to Canada can become a reality when you book online with dealchecker.co.uk. Our simple search allows you to see for yourself who is the cheapest.

Maldives Holidays
If you are looking for a serene, laid back break in the sunshine, Maldives holidays are the choice for you. Be enchanted by the Maldives!

Cheap Canaries Holidays
Are you hunting down cheap Canaries holidays? Well check out ulookubook.com to bag a great value holiday. There are numerous festivals taking place all year round. Why not book your holiday around one?

Cheap Inclusive
Make use of our service at Travel.co.uk to help you to research cheap inclusive holidays.

Cheap Holidays in Portugal
Don't spend your hard earned money on travelling agents! Come to On The Beach, and see information on cheap holidays in Portugal.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51