Peter and Bill,
Thanks for replying to my questions.
I did put a note before and after the run application statement. It said the mbx file is already executed. I think part of my design is not correct. How do I do to make sure it run each time I press the button to execute the mbx file?
This is my design.
For my codes. I called the mbx file with button from my main program.
Call RBNControlSetCustomMBXHandlerIdx(nCtrlIdx, "LaunchAerialGrid")
Then in my aerialtopo.mb, I called the mbx file.
Sub LaunchAerialGrid
Run Application "C:\GeoApps\MapApp2007\AerialGrid\AerialGrid.mbx"
End Sub
What do I need to do so the program does not complain it is already excecuted.
I did add the EndHandler sub as Bill Wemple suggested after my main program. I am not sure if I did right.
Sub EndHandler
Call RBNEndHandler
Exit Sub
End Sub
------------------------------
Michel Li
Programmer
GEOSEARCH LLP
Austin TX
------------------------------
Original Message:
Sent: 05-27-2020 03:00
From: Peter Horsbøll Møller
Subject: Running mbx file from a button closes ribbon
Hi Michel
It seems that something makes your tool crash silently. At least that might explain why the ribbon tab get's removed.
Can you try to put a Note statement before and after the Run Application statement? This might tell you if you successfully run and finish the statement in the procedure called by the button.
Does the AerialGrid tool get loaded?
------------------------------
Peter Horsbøll Møller
Distinguished Engineer
Pitney Bowes Software & Data
Original Message:
Sent: 05-26-2020 14:47
From: Michel Li
Subject: Running mbx file from a button closes ribbon
Hi! I created a button in which when clicking on the button, it will call the procedure to execute. In this procedure, I am calling "run application mbx". When I first clicked, it is working fine and it does execute the mbx file. When I clicked it again to execute the same mbx file because I want to run it again. It closes my ribbon tab. Does anyone know what can be the reason? Here are the codes.
nCtrlIdx = RBNGroupAddButton("showAerialGrid", "Generate Aerial Grid", "A1", sTabName, sGroupName)
If nCtrlIdx > 0 Then
'Create & Set the button tooltip
Call RBNControlSetToolTipIdx(nCtrlIdx, "Generate Aerial Grid", "This will generate Aerial Grid","")
'Set the button icon
Call RBNControlSetIconsIdx(nCtrlIdx, CONTROL_SIZE_LARGE, "", PATH_IMAGES & "aerialgrid.png")
'Set Custom MapBasic Handle to the button
Call RBNControlSetCustomMBXHandlerIdx(nCtrlIdx, "LaunchAerialGrid")
End If
an example is this procedure is:
Sub LaunchAerialGrid
Run Application "C:\GeoApps\MapApp2007\AerialGrid\AerialGrid.mbx"
End Sub
------------------------------
Michel Li
Programmer
GEOSEARCH LLP
Austin TX
------------------------------