Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: MessageDlg and YesToAll button bug



Permlink Replies: 6 - Last Post: May 4, 2015 1:36 PM Last Post By: Alejandro Rosa
Alejandro Rosa

Posts: 23
Registered: 10/30/09
MessageDlg and YesToAll button bug
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 30, 2015 1:01 PM
Hello:

In a form, place a button and put the following code in the OnClick event:

MessageDlg('Overwrite ?', TMsgDlgType.mtConfirmation, [TMsgDlgBtn.mbYes, TMsgDlgBtn.mbNo], 0);

When you press the button 2 buttons appear in the dialog form: Yes, No
GOOD !!!

Now modify the line to add a "Yes to all" button:

MessageDlg('Overwrite ?', TMsgDlgType.mtConfirmation, [TMsgDlgBtn.mbYes, TMsgDlgBtn.mbYesToAll, TMsgDlgBtn.mbNo], 0);

Now, only one button appears. The "OK" button !!!! ERROR !!! ERROR !!! VERY VERY BAD !!

None of the 3 asked buttons appear but now appears a new and undessired button.

Any solution here ?

Thanks.

Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: MessageDlg and YesToAll button bug
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 30, 2015 1:23 PM   in response to: Alejandro Rosa in response to: Alejandro Rosa
Alejandro wrote:

MessageDlg('Overwrite ?', TMsgDlgType.mtConfirmation,
[TMsgDlgBtn.mbYes, TMsgDlgBtn.mbYesToAll, TMsgDlgBtn.mbNo], 0);

Now, only one button appears. The "OK" button !!!! ERROR !!! ERROR
!!! VERY VERY BAD !!

Works fine for me in both VCL and FMX in XE2. What version of Delphi are
you using?

--
Remy Lebeau (TeamB)
Alejandro Rosa

Posts: 23
Registered: 10/30/09
Re: MessageDlg and YesToAll button bug
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 4, 2015 10:46 AM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
{quote:title=Remy Lebeau (TeamB) wrote:}

Works fine for me in both VCL and FMX in XE2. What version of Delphi are
you using?

--
Remy Lebeau (TeamB)

Hi:

I'm usig XE7.

Regards...
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: MessageDlg and YesToAll button bug
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 4, 2015 12:06 PM   in response to: Alejandro Rosa in response to: Alejandro Rosa
Alejandro wrote:

I'm usig XE7.

In XE7, it still works fine in VCL. This is because the VCL MessageDlg()
internally creates a custom VCL TForm, or uses the Win32 API TaskDialogIndirect()
function (depending on OS version and RTL settings), but in both cases dynamically
creates a Button for each specified button in the list, so any button combination
is supported.

However, I can reproduce the problem in FMX in XE7, so I looked at the XE7
implementation of FMX's MessageDlg() and found that on Windows, it is hard-coded
to only support the following button combinations:

[mbOk]
[mbOk, mbCancel]
[mbYes, mbNo, mbCancel, mbYesToAll, mbNoToAll]
[mbYes, mbNo, mbCancel]
[mbAbort, mbRetry, mbIgnore]
[mbAbort, mbIgnore]
[mbYes, mbNo]
[mbRetry, mbCancel]

These are the button combinations supported by the Win32 API MessageBox...()
functions. Any other button combination ends up defaulting to just the OK
button by itself.

The code works fine in XE2 because FMX's MessageDlg() unconditionally created
a custom FMX TForm and dynamically created a TButton for each button in the
list, similar to VCL's MessageDlg().

So I went through subsequent versions and found the issue started in XE3
when IFMXDialogService was introduced to FMX. In XE3 onwards, FMX's MessageDlg()
is delegating to a Win32 API MessageBox...() function (MessageBox() in XE3-XE5,
MessageBoxIndirect() in XE6-XE8). FMX is not delegating to the newer TaskDialogIndirect()
function like VCL does, and thus is not able to support the full range of
button combinations.

So this regression was caused by a redesign of the Windows implementation
of FMX's MessageDlg() and has never been addressed. I have opened a QP ticket
for it:

Regression in supported button combinations in FMX MessageDlg()
https://quality.embarcadero.com/browse/RSP-11093

--
Remy Lebeau (TeamB)
Alejandro Rosa

Posts: 23
Registered: 10/30/09
Re: MessageDlg and YesToAll button bug
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 4, 2015 1:36 PM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Remy Lebeau (TeamB) wrote:
....
So this regression was caused by a redesign of the Windows implementation
of FMX's MessageDlg() and has never been addressed. I have opened a QP ticket
for it:

Regression in supported button combinations in FMX MessageDlg()
https://quality.embarcadero.com/browse/RSP-11093

--
Remy Lebeau (TeamB)

Hi Remy:

Sorry that I never explained all this was specific to FMX. Since it is a firemonkey forum I take it for granted. Sorry if I made you work more.
:)

Thank you.

Regards...
Markus Humm

Posts: 5,113
Registered: 11/9/03
Re: MessageDlg and YesToAll button bug
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 1, 2015 11:52 AM   in response to: Alejandro Rosa in response to: Alejandro Rosa
Am 30.04.2015 um 22:01 schrieb Alejandro Rosa:
Hello:

In a form, place a button and put the following code in the OnClick event:

MessageDlg('Overwrite ?', TMsgDlgType.mtConfirmation, [TMsgDlgBtn.mbYes, TMsgDlgBtn.mbNo], 0);

When you press the button 2 buttons appear in the dialog form: Yes, No
GOOD !!!

Now modify the line to add a "Yes to all" button:

MessageDlg('Overwrite ?', TMsgDlgType.mtConfirmation, [TMsgDlgBtn.mbYes, TMsgDlgBtn.mbYesToAll, TMsgDlgBtn.mbNo], 0);

Now, only one button appears. The "OK" button !!!! ERROR !!! ERROR !!! VERY VERY BAD !!

None of the 3 asked buttons appear but now appears a new and undessired button.

Any solution here ?

Thanks.


What happens if you remove the Yes button?

Greetings

Markus
Alejandro Rosa

Posts: 23
Registered: 10/30/09
Re: MessageDlg and YesToAll button bug
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 4, 2015 11:47 AM   in response to: Markus Humm in response to: Markus Humm
Markus Humm wrote:

What happens if you remove the Yes button?

Greetings

Markus

Hi Markus:

If I put: MessageDlg('Overwrite ?', TMsgDlgType.mtConfirmation, [TMsgDlgBtn.mbYesToAll, TMsgDlgBtn.mbNo], 0);

The same problem appears. Only one "OK" button appears.

You can see a video of the problem here:

[https://www.youtube.com/watch?v=z-4kz1v20-g]

Regards...
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02