Hi, I that a lot users on the forum have this problem.
When you popup a context menu, or some dialog from an event fired from MapPoint, you get a "Server busy" message after 10 seconds. Realy annoying, it allways happens when you demo your code to your boss.
I found my own (imho nicer than sending "esc" char after 9 seconds) solution. You can have your context menu longer open than 10 seconds without problems.
This solution is for C# (so .NET), but it it is just the concept.
Make a timer that sets off after 1 msec. and two variables that hold the mouse position.
Event handler:Code:private System.Windows.Forms.Timer showContextMenuTimer; private int mouseYloc, mouseXloc; // This timer is used to popup a context menu, when // an user has right clicked a symbol on the map showContextMenuTimer = new Timer(); showContextMenuTimer.Tick+=new EventHandler(showContextMenuTimer_Tick); showContextMenuTimer.Interval=1;
When you want to popup a context menu, you simple callCode:private void showContextMenuTimer_Tick(object sender, EventArgs e) { showContextMenuTimer.Stop(); // insert your contextMenu.show routine here... subscriberMenu.Show(this,new Point(mouseXloc+180,mouseYloc+10)); }
showContextMenuTimer.Start();
The problem is (I think) that the contextMenu.show call doesn't return before those 10 seconds. By opening it from a serparate thread it returns immediatly.Code:private void axMappointControl1_BeforeClick(object sender, AxMapPoint._IMappointCtrlEvents_BeforeClickEvent e) { if(e.button==2) // right click { e.cancel=true; mouseXloc = e.x; // used in the Timer.Tick event mouseYloc= e.y; showContextMenuTimer.Start(); } }
have fun with it!