Lazarus

Programming => LCL => Topic started by: Jvan on May 22, 2021, 12:42:52 am

Title: Problem with MessageDLG and Close Button.
Post by: Jvan on May 22, 2021, 12:42:52 am
I have a MessageDLG having two buttons, Yes and No. But when I click the Close button is like I clicked the Yes button.

Code: Pascal  [Select][+][-]
  1. if (MessageDLG('My title', '¿My question?',
  2.         mtConfirmation, [mbYes, mbNo], 0) = mrNo) then Exit;
  3.  
Title: Re: Problem with MessageDLG and Close Button.
Post by: dseligo on May 22, 2021, 01:22:00 am
Do it like this:

Code: Pascal  [Select][+][-]
  1. if (MessageDLG('My title', '¿My question?',
  2.         mtConfirmation, [mbYes, mbNo], 0) <>mrYes) then Exit;
  3.  
Title: Re: Problem with MessageDLG and Close Button.
Post by: Jvan on May 22, 2021, 04:51:17 am
Thanks.
Title: Re: Problem with MessageDLG and Close Button.
Post by: Bart on May 22, 2021, 10:54:24 pm
Which OS?
Which WidgetSet?
Which Lazarus?
This piece of code:
Code: Pascal  [Select][+][-]
  1. messagedlg('Title','Message',mtInformation,[mbYes,mbNo],0);
for me only gives 3 possible result values:
mrNo if I click "No"
mrYes if I click "Yes"
mrCancel if I press Escape or close the dialog using the X border icon.

This is how it was designed to work, if it does not, then something is wrong.

Bart
TinyPortal © 2005-2018