Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Controls
  New Posts New Posts RSS Feed - TaskDialog cancel button
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

TaskDialog cancel button

 Post Reply Post Reply
Author
Message
ElvisM View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 October 2006
Location: Venezuela
Status: Offline
Points: 129
Post Options Post Options   Thanks (0) Thanks(0)   Quote ElvisM Quote  Post ReplyReply Direct Link To This Post Topic: TaskDialog cancel button
    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
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1355
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1355
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
chrisABC View Drop Down
Senior Member
Senior Member
Avatar

Joined: 05 June 2008
Status: Offline
Points: 258
Post Options Post Options   Thanks (0) Thanks(0)   Quote chrisABC Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.