Modal form in android XE5 application
If you want to use modal form in an android XE5 application you need to implement it :)…
You open the form as modal like this:
1 2 3 4 5 6 7 8 9 |
Frm.ShowModal( procedure(ModalResult: TModalResult) begin if ModalResult = mrOK then Begin //Do something End; Frm.Close; end ); |
If you want to return result you must send a procedure as parameter.
In the modal form add:
1 2 3 4 5 6 7 8 9 10 |
type CallForResult = Procedure (ResultValue : Variant) Of Object; procedure OpenFormForResult(Res:CallForResult);Begin Frm.ShowModal( procedure(ModalResult: TModalResult) begin if ModalResult = mrOK then CallForResult('return value'); Frm.Close; end ); End; |
In the calling form you must have a CallForResult procedure eg.:
1 2 3 4 5 |
Procedure FetchResult(ResultValue:Variant); Procedure TForm1.FetchResult(ResultValue:Variant); Begin ShowMessage('Return result:'+VarToStr(ResultValue)); End; |