Link to home
Start Free TrialLog in
Avatar of Member_2_7965240
Member_2_7965240

asked on

Delphi: Android anonymous method problem

Hello,

I have an Android app written in Delphi Seattle.

I need to show a form modally in a function then get back the value of an Edit object.

However, this doesn't work:

Function GetMyValue: String;
Begin
  Form1:=TForm1.Create(Nil);
.....

     ShowModal(
         procedure(ModalResult: TModalResult)
         begin

           if ModalResult = mrOK then
             Begin
              Result  := MyEdit.Text;
             End;
             
         end);

I get a compiler message: [dcc32 Error]  E2555 Cannot capture symbol 'Result'
I know that in anonymous method I cannot refer to the main functions result, but I need to get back the text when the user closes the form.

How can I do that?
Thank you very much!
ASKER CERTIFIED SOLUTION
Avatar of Sinisa Vuk
Sinisa Vuk
Flag of Croatia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial