Please help me... Its urgent
We are developing a VCL Component.
In the constructor I'm creating a Rectangle tool like:
EditTextTool : TRectangleTool;
self.EditTextTool := TRectangleTool.Create(self);
While dragging the component from the pallete(during design time), the constructor is being called and the tool was created.
When we run the application, the constructor is called again, and one more tool was created.
How can I find any existing tools and remove them, before creating new ones...???
Add / Remove TRectangle Tools during RunTime
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Krishna,
You can try doing something like this:
You can try doing something like this:
Code: Select all
procedure TForm1.Button1Click(Sender: TObject);
var
RectTool: TRectangleTool;
i: Integer;
begin
if Chart1.Tools.Count > 0 then
for i:=Chart1.Tools.Count-1 downto 0 do
if (Chart1.Tools[i] is TRectangleTool) then
Chart1.Tools[i].Free;
RectTool:=TRectangleTool.Create(self);
Chart1.Tools.Add(RectTool);
end;
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |