Select to view content in your preferred language

VbScript MsgBox vs. Arcpad Application.MessageBox

4006
3
Jump to solution
05-08-2012 02:41 AM
SteveFitzgerald
Occasional Contributor
I have always scripted using either the vbScript msgbox or the Arcpad MessageBox interchangeably with no particular preference.
At the moment I'm scirpting an Arcpad 8 project and have just noticed that the Application.MessageBox dialog is not modal - you can click on another object on the screen and it will loose focus.
Luckily the VbScript MsgBox is modal and seems to work fine in its place.
Anyone know if this is by design? Has it been fixed in 10?
An example is to paste the following code into a Script dialog and run it with either code. Click on the Script dialog when the message box dialog is displayed to see if its modal.

'VbScript Sub OnFormCancel         Dim bResult     ' comment out either line below to compare messagebox/msgbox behaviour      bResult = Application.MessageBox ("Are you sure you want to cancel?", apYesNo, "Cancel?")     'bResult = msgbox ("Are you sure you want to cancel?", apYesNo, "Cancel?")         If bResult = apNo Then         ThisEvent.Result = False     End If     If bResult = apYes Then         ThisEvent.Result = True     End If End Sub  Call OnFormCancel
Tags (3)
1 Solution

Accepted Solutions
GarethWalters
Deactivated User
Hi Steve,

I doubt that this was either by intentional design or a bug. The biggest reason I know to use the Application.Messagebox is that it will work on any platform or scripting language rather than msgbox for vbScript and MessageBox() for jScript.

Cheers,

Gareth

View solution in original post

0 Kudos
3 Replies
GarethWalters
Deactivated User
Hi Steve,

I doubt that this was either by intentional design or a bug. The biggest reason I know to use the Application.Messagebox is that it will work on any platform or scripting language rather than msgbox for vbScript and MessageBox() for jScript.

Cheers,

Gareth
0 Kudos
RolfBroch
Frequent Contributor
Would be great to enhance the MessageBox function to include a flag so the developer could use this to indicate if the dialog should be modal or not.

Rolf
0 Kudos
SteveFitzgerald
Occasional Contributor
Thanks for clarifying that Gareth.
Regards,
STeve
0 Kudos