Print Page | Close Window

TaskDialog cancel button

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Controls
Forum Description: Topics Related to Codejock Controls
URL: http://forum.codejock.com/forum_posts.asp?TID=13359
Printed Date: 22 November 2024 at 3:18pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: TaskDialog cancel button
Posted By: ElvisM
Subject: TaskDialog cancel button
Date Posted: 08 February 2009 at 8:28pm
Hi friends.
Is there a way to set the taskdialog's cancel button property?
 
I mean, I can set the default button, but I can't set the cancel button.
 
I have a task dialog with 3 buttons. If the user presses the Esc key, the second button fires. I need that when the user presses the Esc key, the third button fires, not second.
 
Regards,
Elvis


-------------
Product: Xtreme SuitePro (ActiveX) version 17.2
Platform: Windows 10 64bits
Language: Visual Basic 2015



Replies:
Posted By: jpbro
Date Posted: 08 February 2009 at 11:16pm
I'm using 12.1.1, and pressing the ESC key doesn't click any button unless that button has a ID of 2. But the strange thing is, the ShowDialog and ButtonClick events return an ID of 8 for the clicked button (even if no button has an ID of 8). Can anyone else confirm this strange behaviour? I assume it is a bug.

This means you would have to have some unusual code to get the third button to be a cancel button:


   With Me.TaskDialog1
      .Reset
     
      .AddButton "OK", 100
      .AddButton "Try Again", 101
      .AddButton "Cancel", 2
     
      If .ShowDialog = 8 Then
         ' 8?? Why does pressing the ESC key return 8 instead of 2?
         Debug.Print "Cancelled"
      Else
         Debug.Print "Not Cancelled"
      End If
   End With





-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6



Posted By: jpbro
Date Posted: 13 February 2009 at 12:22pm
Hi Oleg,

Any idea why the TaskDialog returns 8 when you click a custom button with an ID of 2?


-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6



Posted By: chrisABC
Date Posted: 19 February 2009 at 11:04am
Playing with the Vista TaskDialog sample I find that

      If you have a standard CANCEL button enabled,  clicking CANCEL produces buttonclick event with ID = 8.

      Pressing the ESC key produces buttonclick event with ID = 8

     If I add my own Custom Button with caption = &MyButton   and ID = 11
       then pressing  ALT+M  produces buttonclick event with ID = 11.

My guess is that the ESC keypress is hardwired to the inbuilt Cancel Button event.

With that in mind you can program around this if you need to (as you have done).
I wouldn't call it a bug -- just a feature of the TaskDialog.  But it would have been useful if this was mentioned in the documentation.
 


-------------
Chris (Manchester, UK) -- www.abc6.co.uk ---- Using CodeJock ActiveX Suite 13.1.0 with Windows8, VB6 SP6



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net