Interacting with Dialog Controls

Interacting with Dialog Controls

When a dialog is detached (by setting the Dialog.detach property to True) it becomes possible for your script to interact with the controls on the dialog to a much greater extent. You can read their values at any time, not just after the dialog has closed, and you can also modify their values (both after the dialog has been created and in response to control input). The various methods and properties of the Control object let you read and modify control values while a detached dialog is open.

The following (admittedly artificial!) example demonstrates the script interacting with the controls on a detached dialog.

Clicking one of the five radio buttons performs the following actions:

  • The matching static text (Option one, etc.) will be enabled.

  • The static texts corresponding to the other radio buttons will be disabled.

  • The number field in the bottom-right corner will update to reflect the selected radio button.

  • The static text at the bottom of the dialog will also update to reflect the selection.

Additionally, you can edit the number field in the bottom-right which will cause the appropriate radio button to be selected.

Interacting with Dialog Controls

Interacting with Dialog Controls

最后更新于