Mouse Down Event -> Form_DB.Show-> Problems with Varia

blackmap
01-23-2003, 05:04 AM
Hi Folks,

got a problem with the mouse down event:
On clicking on a pushpin, I open a Form and want to get a variable value from the main form. This only works every second time. With the using of a timer with 5 secs interval it works (bit who wants to wait 5 secs...).

Any ideas?

Thanks a lot

Peter

jia_1980
01-27-2003, 06:33 PM
Hi, I think maybe you can try this sub:
'Map1 is a mappoint control

Private Sub map1_MouseDown(ByVal Button As Long, ByVal Shift As Long, ByVal X As Long, ByVal Y As Long)
Dim xx As Long, yy As Long
'You need check your scalemode property. I am using twip in VB, but mappoint uses pixel.

xx = X / Screen.TwipsPerPixelX
yy = Y / Screen.TwipsPerPixelY


Dim objtemp As MapPoint.FindResults
Set objtemp = objMap.ObjectsFromPoint(X, Y) 'objmap is a mappoint.map object
If TypeOf objtemp.Item(1) Is MapPoint.Pushpin Then
Load Form1 'This is the form you want to show
' Do what you want to do, like "Form1.Label1.Caption = frmSearch.Label1.Caption"
Form1.Show 1
Else
MsgBox "It is not a pushpin"
End If
End Sub

Good luck.

blackmap
01-29-2003, 05:11 AM
That's what I did. It is not working. See above...

blackmap
01-29-2003, 07:17 AM
Private Sub MappointControl1_GotFocus()
If Form_DB.Visible = True Then
Form_DB.SetFocus
End If
End Sub

I commented the code above. Then it worked...

Thanks a lot!!!

 
Web mp2kmag.com
mapforums.com