PDA

View Full Version : How do I get Focus on the Map without a click?



kaod
11-02-2006, 03:37 PM
My problem is to get focus on the map so I can use the rolling mouse directly - that is without first making a click on the map. I have tried 'MyMap.SetFocus' - it seems that you have the focus on the map but you must first click on the map. Does anyone have something to suggest?
Thanks in advance

Wilfried
11-03-2006, 06:35 AM
Hi,

No I tryed also Focus() and Select() but this seems not to work. Maybe a solution is to send a mouse click to the control ?

kaod
11-11-2006, 05:58 AM
Hi,

No I tryed also Focus() and Select() but this seems not to work. Maybe a solution is to send a mouse click to the control ?

Hi - It Did not work what I can see. Have you any further suggestions?
Call PostMessage(Form1.hwnd, &H201, 0, &H6400C8) ' MyMap i Can't user.hwnd. I use the Form instead. Does not work.
Call PostMessage(Me.Text3.hwnd, &H201, 0, 0) ' Postnumber. It works - focus there (mouseclick give you focus).
Regards Katarina

Wilfried
11-11-2006, 08:35 AM
Hi Katarina,

Form1.hwnd is the form's windows handle. Maybe try the MapPoint component's windows handle ? eg if you have named it MP then try MP.Handle

kaod
11-13-2006, 12:19 PM
Hi Katarina,

Form1.hwnd is the form's windows handle. Maybe try the MapPoint component's windows handle ? eg if you have named it MP then try MP.Handle

Hi !
I have tried it before - I cannot find any Handle !?
By a lucky chance I found that objPin.Select will work that is the map is in focus. But just once! If you try the code again it will not work.
Any ideas?
Regards
/Katarina

Here is my code for a button
Private Sub Command1_Click()
sK = "Sweden"
Set objFindOlikaKartor = objMap.FindPlaceResults(sK)
Set oLoc = objFindOlikaKartor.Item(1)
' oLoc.GoTo
Set objPinPlats = objMap.AddPushpin(oLoc)
objPinPlats.Symbol = 28
objPinPlats.Highlight = False
objPinPlats.Name = sK
objPinPlats.BalloonState = geoDisplayBalloon
objPinPlats.Select
'
sK = "Germany"
Set objFindOlikaKartor = objMap.FindPlaceResults(sK)
Set oLoc = objFindOlikaKartor.Item(1)
' oLoc.GoTo
Set objPinPlats = objMap.AddPushpin(oLoc)
objPinPlats.Symbol = 28
objPinPlats.Highlight = False
objPinPlats.Name = sK
objPinPlats.BalloonState = geoDisplayBalloon
objPinPlats.Select
' first time Focus on the map ("Germany") second time no Focus.
Exit Sub

End Sub

Wilfried
11-13-2006, 01:14 PM
Hi Katarina,

I think you use the object model. Dont know if you have a Handle property. You have one when you use the activeX component.