Prompt user – using Yes/No message
Using self.message() in a UI script
The message() function has a question to the user, a title at the top of the box, "QUESTION" is the icon, and YESNO is the type of box.
The last field is the callback function needed to handle the user's choice.
Copy
Using self.message() example
def onBtnImport_Click(self):
self.message("Confirm import of I/C Internal Usage records.", "Import?", "QUESTION", "YESNO", self.onBtnImport_confirmed)
def onBtnImport_confirmed(self, r):
if r == "YES":
self.ImportICInternalUsage() # this runs the ImportICInternalUsage script
Using MessageBox UI class
You can also use the MessageBox UI class . It is a bit trickier to use.
Refer to Sage300/viXXa/doc/MessageBox.html
Copy
Using MessageBox Class example
m = MessageBox(UI) <-- UI should be a ui object - eg self, so use "m = MessageBox(self)"
m.title = "Confirmation"
m.text = "Enter yes or No"
m.buttons = "YesNo"
m.show().onResult(onMessageBoxClosed) <-- the onMessageBoxClosed function to global (not class), or use self.onMessageBoxClosed and add "self" as the first parameter in the onMessageBoxClosed function
def onMessageBoxClosed(p): <-- This either needs to be global, or have a 'self' parameter
if p.result == "yes":
for row in update_rows:
showMessageBox(row)
elif p.result == "no":
pass