Recent

Author Topic: Problem with MessageDLG and Close Button.  (Read 2227 times)

Jvan

  • Full Member
  • ***
  • Posts: 181
Problem with MessageDLG and Close Button.
« 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.  

dseligo

  • Hero Member
  • *****
  • Posts: 1220
Re: Problem with MessageDLG and Close Button.
« Reply #1 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.  

Jvan

  • Full Member
  • ***
  • Posts: 181
Re: Problem with MessageDLG and Close Button.
« Reply #2 on: May 22, 2021, 04:51:17 am »
Thanks.

Bart

  • Hero Member
  • *****
  • Posts: 5289
    • Bart en Mariska's Webstek
Re: Problem with MessageDLG and Close Button.
« Reply #3 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