Alert, Popup, MessageBox

import clr
clr.AddReference("System.Windows.Forms")
from System.Windows.Forms import MessageBox
MessageBox.Show("Foo") 


5 comments:

Anonymous said...

I have implemented MessageBox.Show in my visualization. However when I publish it to web Player, it is giving following error.
Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.

Can anybody help me with the alternatives to do this which shows message, alert to user for specific validation before submitting?

Leviaguirre said...

Yes, it only works in webplayer. You could use a simple javascript to alert('Foo'). Checkout this post to see a javascript example that shows a calendar in both, client and webplayer: http://spotfired.blogspot.com/2014/05/popup-calendar-webplayer-compatible.html

Anonymous said...

Thanks Levaguirre. As I am having Spotfire 5.0 version so I can't apply Javascript on my visualization. However thank you very much for your kind help.

Anonymous said...

Hi Leviaguirre,
How can I tweak the Javascript to display the message only if the rowcount is greater than 100?

Jose Leviaguirre said...

a simple 'if' conditional should do the work: if(rowscount>100):MessageBox.Show("Foo")

I recommend using the javascript version to alert the user so it can be webplayer and client compatible, but you need additional tweaks. The logic remains the same.