I am using Delphi 2006 VCL. In the following code I am creating a component ScrollBox with a series of DBCharts. I have placed the component on a form. When the form opens the scrollbox is displaced with the DBCharts. The problem is that when I open the form again the DBCharts from the last time are persisting. In other words, if I called for 3 DBCharts before and closed the form then called for only two charts the second time, I will see the two new charts plus the third of the 3 charts I did the first time. How can I clear the scrollbox is the question?
Windows, Messages, SysUtils, Classes, Controls, ExtCtrls, DBChart;
TMultiDBChart = class(TScrollBox)
nOnClickChart : TNotifyevent;
procedure DoOnClick(Sender : TObject);
DBCharts : array of TDBChart;
function add : integer;
property OnClickChart: TNotifyEvent read nOnClickChart write nOnClickChart;
procedure TMultiDBChart.DoOnClick(Sender : TObject);
function TMultiDBChart.add : integer;
l : integer;
with DBCharts[l] do
parent := self;
onclick := DoOnClick;
//set width height and posittion of DBChart here.
result := l