Clear VertScrollBox in firemonkey application

  

I have a firemonkey app for android mobile, in XE7, Win8. I have the procedure ShowMsg, below, to show messages into a VertScrollBox.

I´d like to clear the VertScrollBox and I am trying use the ClearVertScrollBox procedure to do it, but I have no success.

Please, what am I doind wrong?

Regards, Luiz

procedure TForm1.ClearVertScrollBox;
var i:integer;
begin
for i:=VSB.ControlsCount-1 downto 0 do
begin
if (VSB.Controls[i] is TCalloutRectangle) then begin
VSB.Controls[i].DisposeOf;
VSB.Controls[i]:=nil;
end;
end;
VSB.Repaint;
end;

var VSB: TVertScrollBox;

procedure TForm1.ShowMsg(Title,GCMMsg,Msg:string);

CR: TCalloutRectangle;
L: TText;
TmpImg: TImage;
begin

CR := TCalloutRectangle.Create(Self);
CR.Parent := VSB;
CR.Align := TAlignLayout.alTop;
CR.CalloutPosition := TCalloutPosition.cpLeft;
CR.Margins.Top := 10;
CR.Margins.Bottom := 10;
CR.Margins.Right := 5;
CR.Height := 75;

L := TText.Create(Self);
L.Parent := CR;
L.Align := TAlignLayout.alTop;
L.Text := Title;
L.Margins.Left := 15;
L.Margins.Right := 5;
L.Width := CR.Width-20;
L.Height:=20;

L := TText.Create(Self);
L.Parent := CR;
L.Align := TAlignLayout.alClient;
L.Text := GCMMsg;//GCMMsg+’:’+Msg;
L.Margins.Left := 15;
L.Margins.Right := 5;
L.Width := CR.Width-20;

L.WordWrap := True;
L.AutoSize := True;
end;

Comments are closed.