Skip to main content
Version: 8.1

system.gui.confirm

This function is used in Python Scripting.

Description

Displays a confirmation dialog box to the user with "Yes" and "No" options, and a custom message.

Client Permission Restrictions

This scripting function has no Client Permission restrictions.

Syntax

system.gui.confirm(message, [title], [allowCancel])

Parameters

TypeParameterDescription
StringmessageThe message to show in the confirmation dialog.
StringtitleThe title for the confirmation dialog. [optional]
BooleanallowCancelShow a cancel button in the dialog. [optional]

Returns

Boolean - True if the user selected "Yes"; false if the user selected "No". None if the user selected "Cancel".

Scope

Vision Client

Code Examples

Example #1
# By using the confirm function in an if statement, we can let the user confirm an action. 
# In this case, we shut down the plant if the user confirms it, otherwise, we don't do anything.

if system.gui.confirm("Are you sure you want to shutdown the plant?", "Really Shutdown?"):
system.db.runUpdateQuery("UPDATE ControlTable SET Shutdown=1")

Keywords

system gui confirm, gui.confirm