#1 2016-05-23 12:34:21

uligerhardt
Member
Registered: 2011-03-08
Posts: 52

SynTaskDialog - custom button IDs?

Is there a way to manually assign button IDs instead of the automatic 100, 101, 102, ...? To be more concrete: I'd like to have a command link with IDCANCEL so that it acts as Cancel button - especially reacting to the Escape key.

Offline

#2 2016-05-23 13:51:10

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,660
Website

Re: SynTaskDialog - custom button IDs?

AFAIR this is how the Windows API work internally...
So I'm afraid we could not change this behavior.

Offline

#3 2016-05-23 14:06:01

uligerhardt
Member
Registered: 2011-03-08
Posts: 52

Re: SynTaskDialog - custom button IDs?

I tried it with VCL's TTaskDialog before my first post and it worked as I wanted.

Looking through SynTaskDialog.pas, I see that it would be a bit tough to add it in it's current state - the contents of TTaskDialog.Buttons would have to evolve into a mini-DSL :-)
I had the idea of internally storing an array of TTASKDIALOG_BUTTON instead of a string (for both emulated and native mode) and then make TTaskDialog.Buttons a read/write property. What do you think?

Last edited by uligerhardt (2016-05-23 14:06:24)

Offline

#4 2016-05-31 07:58:02

uligerhardt
Member
Registered: 2011-03-08
Posts: 52

Re: SynTaskDialog - custom button IDs?

I implemented the ideas from my last post. Are you interested in it?

What has been the "Buttons" member variable is now a read/write property "ButtonsString" tied to an array of TTaskDialogButton named "Buttons". I could rename the two to "Buttons" (as before) and "ButtonItems" or similar if you want it to to be completely backward compatible. (Although I like the current names much more. big_smile)

FWIW: The changes also made it quite trivial to write a wrapper component for visual design (similar to the VCL TTaskDialog), so I did that. smile

Last edited by uligerhardt (2016-05-31 08:00:25)

Offline

Board footer

Powered by FluxBB