Looks like you’ve found it - the answer was indeed the alert()
function.
To respond to your questions about detail:
Is it possible to disable the background form, so that clicking away from the alert/popup doesn’t close it?
Clicking the background in a pop-up will always dismiss it. However, you can loop round if the alert()
returned None
(which it will if you click the background). Eg:
r = None
while r is None:
r = alert("Click OK", buttons=[("OK", True)])
If you actually want to hide the backing form while you display the pop-up dialog, I suppose you could navigate to a blank page temporarily (using open_form()
). This is almost certainly overkill, but here’s how you’d do it:
def button_1_click(self, **event_args):
# Display a blank page
open_form(ColumnPanel())
r = None
while r is None:
r = confirm("Answer Yes or No; don't cancel")
# Display this form again
open_form(self)
This is almost certainly overkill, but I include it for completeness.
on popup, the focus is still on the background form’s button (the one I clicked to show the popup)
You’re right; this was unexpected behaviour. We’ve now changed it so that everything loses focus when you open an alert. This will go live on your apps in the next 24-48 hours.