wsnet Posted June 6, 2019 Share Posted June 6, 2019 I'am use anonymous procedure for Callback Form: Why the variable does not return procedure CallActionFrm2(var I: integer); var AfrmBaseDictionaryList: TfrmBaseDictionaryList; tmp: Integer; begin tmp := I; with TfrmBaseDictionaryList.Create(UniApplication) do begin ShowModal( procedure(Sender: TComponent; AResult: Integer) begin if AResult = mrOk then begin tmp := 100; end; end ); I := tmp; end; end; ... procedure TfrmAdmPlanItem.btnSearchClick(Sender: TObject); var id: Integer; begin id := 1; CallActionFrm2(id); edtInn.Text := IntToStr(id); // get id = 1, but id = 100! end; Why the variable id does not return ? Link to comment Share on other sites More sharing options...
Pep Posted June 7, 2019 Share Posted June 7, 2019 Hello, try this: procedure CallActionFrm2(I: integer); var AfrmBaseDictionaryList: TfrmBaseDictionaryList; tmp: Integer; begin tmp := I; with TfrmBaseDictionaryList.Create(UniApplication) do begin ShowModal( procedure(Sender: TComponent; AResult: Integer) begin if AResult = mrOk then begin tmp := 100; edtInn.Text := IntToStr(tmp); end; end ); end; end; ... procedure TfrmAdmPlanItem.btnSearchClick(Sender: TObject); var id: Integer; begin id := 1; CallActionFrm2(id); end; Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now