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 9 of 9

How to avoid mapppoint control focus when pressing a Key

This is a discussion on How to avoid mapppoint control focus when pressing a Key within the MapPoint Desktop Discussion forums, part of the Map Forums category; I want to use several functional Keys for some special features of my Mappoint control application. However, I cannot avoid ...

  1. #1
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

    How to avoid mapppoint control focus when pressing a Key

    I want to use several functional Keys for some special features of my Mappoint control application. However, I cannot avoid the focus on mappoint control. I tried to set the Property KeyPreview of the main form to true, but my main form still cannot get the KeyDown event, e.g. When pressing F1, the mappoint online help will show up. This is not what I want. Any suggestions and ideas.

  2. #2
    John Meyer's Avatar
    John Meyer is offline Senior Member Blue Belt
    Join Date
    Jul 2002
    Posts
    478
    You'll probably have to use a API function to trap for the keypress. The mappoint control does not have a keypress event like a command button for example. If a command button had the focus you could trap the F1 key like this:

    Private Sub Command1_KeyUp(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyF1 Then
    MsgBox "F1 Pressed" 'do whatever here
    End If
    End Sub

    We are already kind of out of the scope of this forum so I'll leave it at that.

  3. #3
    larry_llama is offline Member Yellow Belt
    Join Date
    Dec 2002
    Posts
    35
    hehheheh another question that i don't have to ask (c:= the answer is as suspected though. is this an easy task (the key interceptor)?

    they really make you jump through hoops to releive your VB app from the grips of the built in mappoint interface.

  4. #4
    dzhong is offline Member Yellow Belt
    Join Date
    Aug 2002
    Posts
    45

    A bug or limitation of Mappoint?

    I tried several ways including Window 32 API and subclass etc, but still failed.

    Who has a solution, please help me!

    Any suggestions are appreciated very much!

  5. #5
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    set the keypreview to true for your form and use this code :

    Private Sub Mpc_GotFocus()
    Me.SetFocus
    End Sub

    Private Sub Mpc_MouseMove(ByVal Button As Long, ByVal Shift As Long, ByVal X As Long, ByVal Y As Long)
    Me.SetFocus
    End Sub

    "Mpc" is the name of the Mappoint control in this case

    This work fine for me, all the keys are intercepted by the form except the four arrows keys, I dont know why only this keys could not be intercept but for all other key it's good.

    Bye

  6. #6
    larry_llama is offline Member Yellow Belt
    Join Date
    Dec 2002
    Posts
    35
    great! thanks for the tip.

    cheers

  7. #7
    dzhong is offline Member Yellow Belt
    Join Date
    Aug 2002
    Posts
    45

    Thanks

    Thank you very much, Coyote!
    The remaining issue is need to place the mouse pointer on the map before you press the key.

  8. #8
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

    Re: Thanks

    Quote Originally Posted by dzhong
    Thank you very much, Coyote!
    The remaining issue is need to place the mouse pointer on the map before you press the key.
    In my case I use Mappoint in full screen in my car (www.media-car.fr.st) then the mouse is always on the map :)

  9. #9
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

    Re: Thanks

    Quote Originally Posted by Anonymous
    Quote Originally Posted by dzhong
    Thank you very much, Coyote!
    The remaining issue is need to place the mouse pointer on the map before you press the key.
    In my case I use Mappoint in full screen in my car (www.media-car.fr.st) then the mouse is always on the map :)
    It was me :)

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Mapppoint Technical Workshop in Paris
    By Mohamed in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 06-08-2006, 03:25 AM
  2. Delphi/Mappoint - Modal Form looses Focus & sent to back
    By PinnacleDev in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 12-06-2004, 10:35 AM
  3. How to programmatically draw a rectangular focus box?
    By Alex Chow in forum MapPoint Desktop Discussion
    Replies: 5
    Last Post: 12-12-2003, 04:53 AM
  4. How to avoid basemaps?
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 04-02-2003, 12:12 PM
  5. MappPoint Data Updates
    By jonesm13 in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 09-30-2002, 11:25 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