Updated Feb 11, 2009:
The Task Dialog is a Windows dialog control released with Windows Vista, and is available in all later versions of the Windows operating system. It is designed to display a dialog box with options or commands that allow the user to perform a “task” (hence the name).
In its most basic configuration the task dialog can just be an aesthetically pleasing replacement to the traditonal message box, but it can be upgraded to include advanced controls like hyperlinks, radio buttons, command links, and progress indicators.
Curtain’s Task Dialog class wraps most of the native Task Dialog’s functionality.
Python 2 isn’t officially supported by Curtains, but users of Python 2 who wish to use the dialog must convert all string input to the unicode type.
Since the task dialog is not always available (happens if the executable does not load comctl32.dll version 6, or if the operating system is older than Vista), you are advised to check that it is before attempting to use it and provide fallback behavior if it isn’t. The dialog functions will do this for you, but if you are accessing the class directly, there is a constant that will help you determine if it is available.
Parameters: |
|
---|
Bind a function to one of the task dialog events. Events and signatures are documented at Task Dialog Events.
Return type: | TaskDialog |
---|
Set the window title of the dialog. Calling this has not effect after show() has been called.
Return type: | TaskDialog |
---|
Set the heading / main instruction of the dialog.
Return type: | TaskDialog |
---|
Set the text content or message that the dialog conveys.
Return type: | TaskDialog |
---|
Set the footer text of the dialog.
Return type: | TaskDialog |
---|
Set the buttons on the dialog using the list of strings in buttons where each string is the label for a new button.
Each string may use some special syntax to give the generated button some extra features. Placing a + sign at the start of the string will cause a shield icon to by displayed on the button (indicating that the button’s command requires elevation). This behavior can be avoided by placing a \ character before the + character.
An ALL CAPS string will cause the button to become the default button on the dialog (unless superceded by another ALL CAPS string). In this event, all letters except the first will be converted to lowercase before assigned to the button. This behavior can be avoided by placing a \ character just before the first letter.
If the button text is any of the following (regardless of letter casing), a stock Windows version of the button is inserted in its place:
ok, cancel, yes, no, retry, close.
Note that none of these buttons will convert to command links even if the directive is given with show(). You can set convert_stock_buttons to false to avoid this behavior.
Calling this method has not effect after show() has been called
Parameters: |
|
---|---|
Return type: | TaskDialog |
Add radio buttons to the dialog using the list of strings in buttons.
Calling this method has not effect after show() has been called
Parameters: |
|
---|---|
Return type: | TaskDialog |
Set the icon that appears at the top of the dialog.
You may use one of the following string literals for the icon argurment:
warning: An exclamation-point icon appears in the dialog box.
error: A stop-sign icon appears in the dialog box.
information: An icon consisting of a lowercase letter i in a circle appears in the dialog box.
shield: A security crest icon appears in the dialog box.
Alternatively, the icon argument may be any value returned by loadoemicon().
Calling this method has not effect after show() has been called
Return type: | TaskDialog |
---|
Set the icon that appears in the footer of the dialog.
See set_main_icon().
Calling this method has not effect after show() has been called
Return type: | TaskDialog |
---|
Set up a collapsible control that can reveal further information about the task that the dialog performs.
Calling this method has not effect after show() has been called
Parameters: |
|
---|---|
Return type: | TaskDialog |
Set the progress bar on the task dialog as a marquee progress bar.
Marquee progress bars do not have a set range; the progress indicator moves across the bar in a loop.
Calling this method has not effect after show() has been called
Parameters: |
|
---|---|
Return type: | TaskDialog |
Set the progress bar on the task dialog.
Calling this method has not effect after show() has been called
Parameters: |
|
---|---|
Return type: | TaskDialog |
Set up a verification check box that appears on the task dialog.
Parameters: |
|
---|
Calling this method has not effect after show() has been called
Return type: | TaskDialog |
---|
Set the width, in pixels, of the taskdialog.
Calling this method has not effect after show() has been called
Return type: | TaskDialog |
---|
Build and display the dialog box.
Parameters: |
|
---|---|
Returns: | three element tuple with indices: 0: original text of the clicked button, unless a stock button was used in which case the lowercase variants are used (see set_buttons()). 1: original text of the clicked radio button if a radio button was clicked, 0 otherwise. 2: bool indicating whether the checkbox (if any set) was checked. |
The task dialog supports the follow events, which are listened for by calling TaskDialog.bind():
- curtains.CREATED¶
Gets fired when the task dialog is created.
Callback signature: ()
- curtains.NAVIGATED¶
FIXME: Not really sure what this does.
Callback signature: ()
- curtains.BUTTON_CLICKED¶
Gets fired when a button is clicked on the dialog.
Callback signature: (label)
label: Text label of the clicked button.
- curtains.RADIO_BUTTON_CLICKED¶
Gets fired when a radio button is clicked on the dialog.
Callback signature: (label)
label: Text label of the clicked radio button.
- curtains.HYPERLINK_CLICKED¶
Gets fired when a hyperlink is clicked (the hyperlinks agrument to show() must have been set to True).
Callback signature: (href)
href: The href parameter of the hyperlink that was clicked.
- curtains.TIMER¶
Gets fired approximately every 200 milliseconds.
Callback signature: (ticks)
ticks: number of milliseconds since last TIMER event.
- curtains.DESTROYED¶
Gets fired when the dialog is destroyed (after being closed, etc.)
Callback signature: ()
- curtains.VERIFICATION_CLICKED¶
Gets fired when the verification check box is clicked.
Callback signature: (checked)
checked: True if box is now checked, false if not.
- curtains.EXPANDER_BUTTON_CLICKED¶
Gets fired when the expander control is clicked.
Callback signature: (collapsed)
collapsed: True if the expander control if collapsed, false if not.