訊息視窗也是最入門要學的技巧,看了一個網站提供了MessageDlgs Example,頓時了解FireMonkey 的訊息視窗用法不變,但參數用法有點不一樣? 做個心得記錄
來源網站:http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=2097&lngWId=7 (內有範例)
//原本使用的方法 if MessageDlg('hello world', mtConfirmation, [mbYes, mbNo], 0) = mrYes) then …. //Firemonkey寫法 if MessageDlg('hello world', TMsgDlgType.mtConfirmation, mbYesNo, 0) = IDYES then …. //不只yes no 還有ok cancel Abort Ignore
原本的[mbYes, mbNo],改為 mbYesNo,到底有哪幾種呢?
FMX.Dialogs.pas內有定義擷取如下
const mbYesNo = [TMsgDlgBtn.mbYes, TMsgDlgBtn.mbNo]; mbYesNoCancel = [TMsgDlgBtn.mbYes, TMsgDlgBtn.mbNo, TMsgDlgBtn.mbCancel]; mbYesAllNoAllCancel = [TMsgDlgBtn.mbYes, TMsgDlgBtn.mbYesToAll, TMsgDlgBtn.mbNo, TMsgDlgBtn.mbNoToAll, TMsgDlgBtn.mbCancel]; mbOKCancel = [TMsgDlgBtn.mbOK, TMsgDlgBtn.mbCancel]; mbAbortRetryIgnore = [TMsgDlgBtn.mbAbort, TMsgDlgBtn.mbRetry, TMsgDlgBtn.mbIgnore]; mbAbortIgnore = [TMsgDlgBtn.mbAbort, TMsgDlgBtn.mbIgnore];
原本使用mtConfirmation,卻不能用,要改為TMsgDlgType.mtConfirmation
System.UITypes.pas內有定義擷取如下
{ Message dialog } TMsgDlgType = (mtWarning, mtError, mtInformation, mtConfirmation, mtCustom);
文章標籤
全站熱搜
留言列表