unigui ShowModal、MessageDlg

procedure Calback(Sender: TComponent; AResult: Integer);
procedure TForm.Calback(Sender: TComponent; AResult: Integer);
begin
  case AResult of
    mrYes:
      begin

      end;
    mrNo:
      begin

      end;
  end;
end;

 //fomr窗体不需要代码创建 如下会报错

var
  F_Envcategory: TF_Envcategory;
begin
  F_Envcategory := TF_Envcategory.Create(self);
  F_Envcategory.ShowModal(Calback);

  FreeAndNil(F_Envcategory);

 

//直接调用
  F_Form.ShowModal(Calback);

   

//-------------------------------------------------

Form.ShowModal(
         procedure(Sender: TComponent; Res: integer)
          begin
                  case Res of
                        mrYes :
                        begin
                          UniEdit1.Text:='1';
                        end;
                        mrNo :
                        begin
                          UniEdit1.Text:='0';
                        end;
                  end;

          end

 );


 
 ModalResult := mrYes;
 ModalResult := mrNo;

------------------------------------

 MessageDlg('是否?', mtConfirmation, mbOKCancel,
    procedure(Sender: TComponent; Res: Integer)
    begin
      if Res = mrOk then
      begin
         
        end
        else
        begin
         
        end;

      end;
    end);

你可能感兴趣的:(unigui)