Delphi FMX: DisposeOf control work in windows paltform but not working in Android. what’s the problem?

  

I create a button at runtime and set onclick event same as below:
BDel := TButton.Create(CR);//CR is Tpanel
BDel.Parent := CR;
BDel.Position.Y := 115;
BDel.Width := 120;
BDel.Height := 32;
BDel.Position.X := 150;
BDel.Text := ‘Delete Panel’;
BDel.OnClick := BdelClick;

Button is inside the Panel. onClick procedure is as below:
procedure TForm1.BdelClick(Sender: TObject);
var
tt: TPanel;
begin
tt := ((Sender as TButton).Parent as TPanel);
tt.DisposeOf;
end;

This code worked properly in windows platform and button with its parent removed but not worked in Android. What’s the problem?

Comments are closed.