Member_2_7965240
asked on
Delphi Anonymous ShowModal and Android problem
Hello,
I tried this : http://blog.marcocantu.com/blog/xe5_anonymous_showmodal_android.html
and my problem is that using this code:
The  dlg.DisposeOf; gives Access Violation error.
I tried it with Free, but that gives the same error message.
How can I free the form then? Thank you.
I tried this : http://blog.marcocantu.com/blog/xe5_anonymous_showmodal_android.html
and my problem is that using this code:
var
dlg: TForm1;
begin
dlg := TForm1.Create(nil);
// select current value, if avaialble in the list
dlg.ListBox1.ItemIndex := dlg.ListBox1.Items.IndexOf(Edit1.Text);
dlg.ShowModal(
procedure(ModalResult: TModalResult)
begin
if ModalResult = mrOK then
// if OK was pressed and an item is selected, pick it
if dlg.ListBox1.ItemIndex >= 0 then
edit1.Text := dlg.ListBox1.Items [dlg.ListBox1.ItemIndex];
dlg.DisposeOf;
end);
The  dlg.DisposeOf; gives Access Violation error.
I tried it with Free, but that gives the same error message.
How can I free the form then? Thank you.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
if you would have put it after the showmodal method, it might have worked.