Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 7 of 7

Trying to get the MapPoint.Location at a mouse event

This is a discussion on Trying to get the MapPoint.Location at a mouse event within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hi, I need to present a MapPoint map to the user and allow him to click (or double-click) the location ...

  1. #1
    BobFromBoston is offline Senior Member Green Belt
    Join Date
    Jul 2005
    Posts
    128

    Trying to get the MapPoint.Location at a mouse event

    Hi,

    I need to present a MapPoint map to the user and allow him to click (or double-click) the location of interest. Then I'd like to get the MapPoint.Location which corresponds to his click.

    I don't think the mouse-down or mouse-up events will work, since I want the user to be able to use the default mouse features of MapPoint to select his active map area. So I think that means I need to use double-click, and that causes a problem since MapPoint will display a dialog with nearby addresses, upon a double click.

    I woud like to find out how to retrieve the address selected by the user, but I don't know how. So I have been left with overriding BeforeDblClick, but this code only gets called if the user double-clicks on a part of the map where there are not too many streets. If he double-clicks where there are other roads, the dialog willcome up and my code won't get called.

    Any ideas?

    Thanks.

  2. #2
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    Hi,

    Use the BeforeClick and check the Shift or Control. So user have control or if he click with Shift or Ctrl he has your code.

  3. #3
    BobFromBoston is offline Senior Member Green Belt
    Join Date
    Jul 2005
    Posts
    128

    Ctrl or Shift is a great idea!

    Hi,

    That's a great way to differentiate a double-click. But how do I check if either of these keys was down?


    Thanks,
    Bob

  4. #4
    BobFromBoston is offline Senior Member Green Belt
    Join Date
    Jul 2005
    Posts
    128

    I tried using the keyboard too, but without success

    Hi,

    I actually quickly tried the Ctrl and Alt keys, but they didn't help. When I override the BeforeDblClick event, the MapPoint dialog of addresses sometimes gets the event, leaving my code untouched. It turns out that when I double-click in a area with lots of street and intersections, the MapPoint dialog comes up displaying alternatives. But if I click away from other streets, I get the event in my BeforeDblClick event handler.

    Would anybody know how to get the address selected by the user? Any selection in the dialog will obviously be close, and I only need the lat/long actually. But this dialog (of MapPoint's) is stealing the event so my event handler never gets the lat/long of the mouse double-click.

    Thanks,
    Bob

  5. #5
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    Hi,

    I just checked, and you only can see if the shift was pressed down. So you can determine the dfference. If shift was pressed down you set Cancel to True and this will cancel the action that mappoint will normally do, so you can safe execute your code.

    You dont have the lat/long in the clickevent but you have the x/y coordinates of the screen, so you can use them.

  6. #6
    Joel is offline Junior Member White Belt
    Join Date
    Aug 2003
    Posts
    10

    Event

    Can't the SelectionChange event be used?

  7. #7
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    Hi,

    Can't the SelectionChange event be used?
    Possible yes, but he wants to cancel the mappoint popup menu if I have understeand it well, and that only can be done in the beforeClick events.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Capturing Mouse Wheel Event
    By Anonymous in forum Bing Maps and MapPoint Web Service
    Replies: 2
    Last Post: 11-30-2005, 08:31 AM
  2. find city name & state name on mouse move event
    By Atul22 in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 10-15-2004, 05:28 AM
  3. is there a way of geting the location of the mouse pointer
    By matt1168 in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 07-04-2003, 02:25 PM
  4. mouse down event
    By henemonster in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 03-31-2003, 03:04 PM
  5. Mouse Down Event -> Form_DB.Show-> Problems with Varia
    By blackmap in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 01-29-2003, 08:17 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


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