<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Hi all,</p>
<p>I am currently wondering how to interpret the ModalResult of
TTaskDialog if the Button "Close" was clicked. "Close" returns
"mrAll" in windows and "mrAbort" in Linux (GTK2) - is that
intended? I somehow expected mrClose. In the code of TTaskDialog,
for ButtonIDs < 100, the ModalResult is directly translated
from the ButtonID, so maybe it is intended? (taskdialog.inc, Lines
98 and following:)<br>
</p>
<pre><code><font size="3" face="Courier New"><b>function </b>TCustomTaskDialog<font color="red">.</font>ButtonIDToModalResult<font color="red">(</font><b>const </b>AButtonID<font color="red">: </font>Integer
<font color="red">): </font>TModalResult<font color="red">;
</font><b>begin
if </b>AButtonID<font color="red"><</font><font color="navy">100 </font><b>then
</b>Result <font color="red">:= </font>AButtonID <----- HERE
<b>else if </b><font color="red">(</font>AButtonID<font color="red">-</font><font color="navy">100</font><font color="red"><</font>Buttons<font color="red">.</font>Count<font color="red">) </font><b>then
</b>Result <font color="red">:= </font>Buttons<font color="red">[</font>AButtonID<font color="red">-</font><font color="navy">100</font><font color="red">].</font>ModalResult
<b>else
</b>Result <font color="red">:= </font>mrNone<font color="red">;
</font><b>end</b><font color="red">;</font></font></code></pre>
<p>I searched the Web and Mantis but did neither find a Bug report
nor a List like "ClickedButton -> ModalResult" or alike.</p>
<p>You can test by dropping a TTaskDialog on a form and using the
following code at a TButton:</p>
<pre><code><font size="3" face="Courier New"><font color="black"><b>procedure </b>TForm1<font color="red">.</font>Button1Click<font color="red">(</font>Sender<font color="red">: </font>TObject<font color="red">);
</font><b>begin
</b>TaskDialog1<font color="red">.</font>CommonButtons<font color="red">:=[</font>tcbOk<font color="red">,</font>tcbYes<font color="red">,</font>tcbNo<font color="red">,</font>tcbCancel<font color="red">,</font>tcbRetry<font color="red">,</font>tcbClose<font color="red">];
</font><b>if </b>TaskDialog1<font color="red">.</font>Execute <b>then begin
case </b>TaskDialog1<font color="red">.</font>ModalResult <b>of
</b>mrOK<font color="red">: </font>Memo1<font color="red">.</font>Lines<font color="red">.</font>Add<font color="red">(</font><font color="blue">'mrOK'</font><font color="red">);
</font>mrCancel<font color="red">: </font>Memo1<font color="red">.</font>Lines<font color="red">.</font>Add<font color="red">(</font><font color="blue">'mrCancel'</font><font color="red">);
</font>mrAbort<font color="red">: </font>Memo1<font color="red">.</font>Lines<font color="red">.</font>Add<font color="red">(</font><font color="blue">'mrAbort'</font><font color="red">);
</font>mrRetry<font color="red">: </font>Memo1<font color="red">.</font>Lines<font color="red">.</font>Add<font color="red">(</font><font color="blue">'mrRetry'</font><font color="red">);
</font>mrIgnore<font color="red">: </font>Memo1<font color="red">.</font>Lines<font color="red">.</font>Add<font color="red">(</font><font color="blue">'mrIgnore'</font><font color="red">);
</font>mrYes<font color="red">: </font>Memo1<font color="red">.</font>Lines<font color="red">.</font>Add<font color="red">(</font><font color="blue">'mrYes'</font><font color="red">);
</font>mrNo<font color="red">: </font>Memo1<font color="red">.</font>Lines<font color="red">.</font>Add<font color="red">(</font><font color="blue">'mrNo'</font><font color="red">);
</font>mrAll<font color="red">: </font>Memo1<font color="red">.</font>Lines<font color="red">.</font>Add<font color="red">(</font><font color="blue">'mrAll'</font><font color="red">);
</font>mrNoToAll<font color="red">: </font>Memo1<font color="red">.</font>Lines<font color="red">.</font>Add<font color="red">(</font><font color="blue">'mrNoToAll'</font><font color="red">);
</font>mrYesToAll<font color="red">: </font>Memo1<font color="red">.</font>Lines<font color="red">.</font>Add<font color="red">(</font><font color="blue">'mrYesToAll'</font><font color="red">);
</font>mrClose<font color="red">: </font>Memo1<font color="red">.</font>Lines<font color="red">.</font>Add<font color="red">(</font><font color="blue">'mrClose'</font><font color="red">);
</font><b>else
</b>Memo1<font color="red">.</font>Lines<font color="red">.</font>Add<font color="red">(</font>Format<font color="red">(</font><font color="blue">'Unknown: %d'</font><font color="red">, [</font>TaskDialog1<font color="red">.</font>ModalResult<font color="red">]));
</font><b>end</b><font color="red">;
</font><b>end</b><font color="red">;
</font><b>end</b><font color="red">;</font></font></font></code></pre>
<p>Thank you and</p>
<p>with best wishes,</p>
<p>Alex<br>
</p>
</body>
</html>