What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [Resource] TaskDialog Class (Updated 25/08/2008)

Pages: (2): « First [ 1 ] 2 » Last »
[Resource] TaskDialog Class (Updated 25/08/2008)
Author: Message:
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
31 / Male / Flag
Joined: Apr 2004
O.P. [Resource] TaskDialog Class (Updated 25/08/2008)
TaskDialog Class
Last updated on 25 August 2008

What the...?
The TaskDialog class provides easy access to the task dialog functionality of Windows Vista or higher.

What's a task dialog?
A task dialog is the brand new replacement for the good old "message box". It has much more customisable areas than the message box and is much more flexible.

What's in a task dialog?
Following is a description of the different parts of a task dialog. Note that not all parts have to be displayed in every task dialog, only the parts you define will be displayed.
  • Title - The text what is displayed in the title bar.
  • Main icon - The icon displayed next to the content.
  • Main instruction - The text displayed as heading of the task dialog.
  • Content - The actual content of the task dialog.
  • Radio buttons - A list of custom radio buttons.
  • Common buttons - Some standard buttons (such as OK, Cancel, Yes and No). Unlike the old message box, the task dialog allows any combination of these buttons, so you are free to use "OK/Cancel/Retry" or "Yes/No/Retry".
  • Custom buttons - Extra buttons added to display. If you enable command links, such as in the screenshot, the buttons are displayed as command links. Otherwise, they are displayed next to the common buttons.
  • Expand/Collapse button - The button to toggle the expandable area. You can change the text on this button (both in expanded as collapsed state).
  • Verification checkbox - A checkbox displayed at the left of the common buttons, usually used for a verification like "Do not show this message again" but you can use it for anything you like.
  • Footer - The text displayed at the bottom of the window, used for footnotes or additional information. Can have an icon.
  • Expandable area - The text toggled by the expand/collapse button.
Okay, how do I use this?
The class consists of a lot of properties and methods which allow you to configure the task dialog and finally show it. Here's a quick instruction guide to get started quickly:
  1. Create a new instance of the TaskDialog class.
    code:
    var MyDialog = new TaskDialog();
  2. Set your desired properties and call any method you need to prepare the task dialog.
    code:
    MyDialog.Title = "My task dialog";
    MyDialog.Content.Instruction = "Installation successful";
    MyDialog.Content.Text = "Do you want to start the program now?";
    MyDialog.Content.SetIcon(TaskDialog.Icons.Question);
    MyDialog.CommonButtons.Add("Yes", "No");
  3. Open the task dialog using either Show() or ShowAndDestroy().
    code:
    var Result = MyDialog.Show();
  4. The return value of Show() is an object with information about the user's input. If the function succeeds, the following members are available:
    • btn : String identifier of the clicked button.
    • radio : String identifier of the selected radio button.
    • verif : Boolean specifying whether the verification checkbox was checked.
    • result : Number specifying the return value of the call to "TaskDialogIndirect". This equals S_OK (0x0) when the function succeeds.
    If the function fails, the following members are available:
    • lastError : Number specifying the result of Interop.GetLastError() after "TaskDialogIndirect" was called.
    • result : Number specifying the return value of the call to "TaskDialogIndirect".
  5. You can re-use the class instance to show more than one dialog per instance.
    code:
    ...
    MyDialog.Show();
    ...
    MyDialog.Content.Text = "New content goes here";
    MyDialog.Show();
  6. When you're done using the instance, call Destroy() to clear any created memory structures used by the class. Alternatively, you can use ShowAndDestroy() which combines Show() and Destroy().
    Note: Even after calling Destroy(), you can still re-use the instance! All required structures will be regenerated once you call Show(). Don't forget to destroy your instance at the very end however!
Where can I learn more about the actual properties, methods and child objects?
The script file of the class has a huge comment block with information about everything in the class. Use it as a reference, but don't forget to remove it when you're about to release your script! It'd be a waste of kilobytes to keep all those lines of comments in a file which may be downloaded by hundreds or thousands of users.

Right, where can I get this class thing?
» Download the TaskDialog Example script
» Download the TaskDialog class only

Change-log:
  • 1.0.1 @ 25 August 2008 - Small code restructure. No changes were made to the structure of the properties and methods so your script doesn't need any changes to work with this update.
  • 1.0.0 @ 23 August 2008 - Initial release
Screenshot:
[Image: TaskDialogClass.png]

This post was edited on 08-25-2008 at 08:45 AM by Matti.
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
08-23-2008 04:05 PM
Profile E-Mail PM Web Find Quote Report
Felu
Veteran Member
*****


Posts: 2223
Reputation: 72
29 / Male / Flag
Joined: Apr 2006
Status: Away
RE: [Resource] TaskDialog Class (Updated 23/08/2008)
Woah nice work! Awesome.

Will check this out :).
08-23-2008 04:11 PM
Profile E-Mail PM Web Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
RE: [Resource] TaskDialog Class (Updated 23/08/2008)
And it's all freeware :)
08-24-2008 04:17 PM
Profile PM Find Quote Report
ShawnZ
Veteran Member
*****

Avatar

Posts: 3146
Reputation: 43
32 / Male / Flag
Joined: Jan 2003
RE: [Resource] TaskDialog Class (Updated 23/08/2008)
why wouldn't it be freeware o.O
Spoiler:
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
08-24-2008 07:10 PM
Profile PM Web Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
RE: [Resource] TaskDialog Class (Updated 23/08/2008)
I've seen some payware things, most of which are of low quality, for what I've seen of them.
08-24-2008 07:13 PM
Profile PM Find Quote Report
ShawnZ
Veteran Member
*****

Avatar

Posts: 3146
Reputation: 43
32 / Male / Flag
Joined: Jan 2003
RE: [Resource] TaskDialog Class (Updated 23/08/2008)
you've seen payware msgplus scripts? :p
Spoiler:
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
the game.
08-24-2008 07:16 PM
Profile PM Web Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
RE: [Resource] TaskDialog Class (Updated 23/08/2008)
Not particularly MsgPlus script, just JScript code in general :P
08-24-2008 07:25 PM
Profile PM Find Quote Report
Winky
New Member
*

Avatar

Posts: 8
32 / Male / Flag
Joined: May 2007
RE: RE: [Resource] TaskDialog Class (Updated 23/08/2008)
quote:
Originally posted by SmokingCookie
Not particularly MsgPlus script, just JScript code in general :P
And that brings me on a question: Can we use it for non !plus scripts to?

Anyway nice class, very usefull. :)

This post was edited on 08-24-2008 at 07:32 PM by Winky.
08-24-2008 07:31 PM
Profile PM Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
RE: [Resource] TaskDialog Class (Updated 23/08/2008)
No, this class cannot be used from outside Plus!, unless you can create an Interop object (which I think is impossible, 'cause Patchou is probably the only one who knows how to).
08-24-2008 07:34 PM
Profile PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
31 / Male / Flag
Joined: Apr 2004
O.P. RE: [Resource] TaskDialog Class (Updated 23/08/2008)
Thanks for all the great comments, I appreciate that! :)
quote:
Originally posted by Winky
And that brings me on a question: Can we use it for non !plus scripts to?
Sure you can! If you happen to be coding in a programming language which has no support for "struct" definitions and you need to make such a memory structure all by yourself, you might be helped by the "UpdateConfig" method of this class, which writes all 96 bytes (that's 24 DWORD values!) required for the TASKDIALOGCONFIG. However, I don't know about any "real" programming language which requires you to do this. :P
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
08-25-2008 07:38 AM
Profile E-Mail PM Web Find Quote Report
Pages: (2): « First [ 1 ] 2 » Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On