Hi all,
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:)
|*function *TCustomTaskDialog.ButtonIDToModalResult(*const *AButtonID: Integer ): TModalResult; *begin if *AButtonID<100 *then *Result := AButtonID <----- HERE *else if *(AButtonID-100<Buttons.Count) *then *Result := Buttons[AButtonID-100].ModalResult *else *Result := mrNone; *end*;|
I searched the Web and Mantis but did neither find a Bug report nor a List like "ClickedButton -> ModalResult" or alike.
You can test by dropping a TTaskDialog on a form and using the following code at a TButton:
|*procedure *TForm1.Button1Click(Sender: TObject); *begin *TaskDialog1.CommonButtons:=[tcbOk,tcbYes,tcbNo,tcbCancel,tcbRetry,tcbClose]; *if *TaskDialog1.Execute *then begin case *TaskDialog1.ModalResult *of *mrOK: Memo1.Lines.Add('mrOK'); mrCancel: Memo1.Lines.Add('mrCancel'); mrAbort: Memo1.Lines.Add('mrAbort'); mrRetry:
Memo1.Lines.Add('mrRetry'); mrIgnore: Memo1.Lines.Add('mrIgnore'); mrYes: Memo1.Lines.Add('mrYes'); mrNo: Memo1.Lines.Add('mrNo'); mrAll: Memo1.Lines.Add('mrAll'); mrNoToAll: Memo1.Lines.Add('mrNoToAll'); mrYesToAll: Memo1.Lines.Add('mrYesToAll'); mrClose: Memo1.Lines.Add('mrClose'); *else *Memo1.Lines.Add(Format('Unknown: %d', [TaskDialog1.ModalResult])); *end*; *end*; *end*;|
Thank you and
with best wishes,
Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20190911/de676ab7/attachment.html>
