UniGUI之提示信息MessageDlg及獲得信息Prompt及UniSweetAlert(15)


1]彈出信息MessageDlg

2]獲得信息Prompt

3]漂亮反饋UniSweetAlert


1]UniGui的彈出信息MessageDlg的原型定義如下:

procedure MessageDlg(const Msg: string; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; CallBack: TUniDialogCallBackAnonProc); 

其中DlgType(對話框架的類型)
1、mtConfirmation
2、mtCustom
3、mtError
4、mtInformation
5、mtWarning


示例如下

procedure TMainForm.UniThemeButton1Click(Sender: TObject);
begin
 MessageDlg('This is a confirmation!', mtConfirmation, [mbOK],nil);
UniSession.AddJS('Ext.get("messagebox-1001_header-title-textEl").setText("確認")');

MessageDlg('This is information!', mtInformation, [mbOK],nil);
UniSession.AddJS('Ext.get("messagebox-1001_header-title-textEl").setText("信息")');
 MessageDlg('This is a warning!', mtWarning, [mbOK],nil);
UniSession.AddJS('Ext.get("messagebox-1001_header-title-textEl").setText("警告")');
  MessageDlg('This is an Error!', mtError, [mbOK],nil);
UniSession.AddJS('Ext.get("messagebox-1001_header-title-textEl").setText("錯誤")');
end;

最后一個參數的使用方法:
 //mbYes,mbYesNo, mbYesNoCancel, mbOk ,mbOkCancel
  MessageDlg('是否?', mtConfirmation, mbYesNoCancel,
    procedure(Sender: TComponent; Res: Integer)
    begin
      Case Res of
        mrYes: // 點Yes后執行的語句
          begin
            caption := 'mrYes'
          end;
        mrNo:   // 點No后執行的語句
          begin
            caption := 'mrNo'
          end;
        mrCancel:   // 點Cancel后執行的語句
          begin
            caption := 'Mrcancel'
          end;
      end;
    end);

 更多信息參見官網說明:

uniGUIDialogs.MessageDlg


2]類似地 Prompt獲得數據//uniGUIDialogs.Prompt
procedure Prompt(const AMsg: string; const AValue: string; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; CallBack: TUniPromptCallBackAnonProc; MultiLines: Boolean = False); overload;
  Prompt('Please enter a text', '默認輸入值', mtInformation, mbOkCancel,
    procedure(Sender: TComponent; AResult: Integer; AText: string)      begin
      Case AResult of
        mrOk: // 點Ok后執行的語句
          begin
            caption := AText + 'Ok'
          end;
        mrCancel: // 點Cancel后執行的語句
          begin
            caption := AText + 'Mrcancel'
          end;
      end;
    end, true // 是否多行
  );

 


3]漂亮反饋UniSweetAlert

UniSweetAlert1.Show();

 總是說我字少 總是說我字少 總是說我字少 總是說我字少 總是說我字少總是說我字少 總是說我字少 總是說我字少 總是說我字少 總是說我字少


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM