Dear All,
I have a VB6 integrated mapping application which works together with
MapInfo Pro. Users need to interact with both applications at any given
time - so managing the two interfaces is important. I use the Windows API
'SetWindowPos' to make sure that my VB form always appears over the MapInfo
window. However if dialogs (e.g. layer control) are invoked from MapInfo,
these appear under my form too. To remedy this, I use the "set application
window " MapInfo command to ensure that these dialogs are children of by VB
form and therefore appear over it.
So far so good. However, the following bug has come to light. If my form
(now the 'application window') is running, certain MapBasic applications do
not run correctly. It transpires that the 'CommandInfo' statement does not
always work correctly in these MapBasic applications when a form of another
application is the 'application window'. In particular the 'CommandInfo'
statement doesn't work when it is used directly after a 'Dialog' statement
in the handler of a PushButton. Curiously, its fine in the hanlders of
ToolButtons. I believe that this must be a bug and I cannot find a
workaround. Do you have any suggestions?
The following code is all you need to reproduce the problem. If you compile
and run the MBX on its own then both buttons work OK. However if you
compile and run the VB application, then the MBX no longer works propery -
use the right hand button (the PushButton) and then 'okay' the dialog - the
code cannot detect that you've used the OKButton.
Richard Burkmar
ICL
################
MapBasic program:
################
Include "mapbasic.def"
Include "icons.def"
Declare Sub Main
Declare Sub ShowDlg
Sub Main
Create ButtonPad "Bug Test" As
ToolButton
Calling ShowDlg
Drawmode DM_CUSTOM_RECT
PushButton
Calling ShowDlg
Show
End Sub
Sub ShowDlg
Dialog Title "Bug Test"
Control OkButton
Control CancelButton
If CommandInfo(CMD_INFO_DLG_OK) Then
Note "Okayed"
Else
Note "Not okayed"
End If
End Sub
#################################
VB application (code from form module):
#################################
Private mobjMI As MapInfo.MapInfoApplication
Private Sub Form_Load()
Set mobjMI = GetObject(, "MapInfo.Application")
End Sub
Private Sub Form_Activate()
mobjMI.Do "set application window " & Me.hwnd
End Sub
----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]