Hi,
Delph 2007 and Teetree2 included Teechart Pro VCL 8.04
I try change presentation of Tree by (Explorer, Left , Top or ListView) , at runtime but i have exception.
What is the best practice in this subject ??
My code ================================================================
function TreePrepareManager(ATree:TTree;AChildManager:TObject):integer;
begin
if ATree=nil then exit;
try
// Typ de tree Explorateur ; top ; Left ; ListView (PB not ancestor common!!)
if (AChildManager is TTreeExplorerAlignChild) then
ATree.ChangeManager(AChildManager as TTreeExplorerAlignChild)
else if AChildManager is TTreeTopBottomAlignChild then
ATree.ChangeManager(AChildManager as TTreeTopBottomAlignChild)
else if AChildManager is TTreeLeftRightAlignChild then
ATree.ChangeManager(AChildManager as TTreeLeftRightAlignChild)
else if AChildManager is TTreeListViewAlignChild then
ATree.ChangeManager(AChildManager as TTreeListViewAlignChild);
Except
CT_ERR.Push('U_TreeEfc.pas : Procedure PrepareChildManager'); Raise; // exception vioalion access !!!
End;
end;
in my forms========================================
constructor TFrameEfcTree.Create(AOwner: TComponent);
begin
inherited;
// Format of the tree
ChildExplorateur :=TTreeExplorerAlignChild.Create;
ChildTop :=TTreeTopBottomAlignChild.Create;
ChildLeft :=TTreeLeftRightAlignChild.Create;
ChildList :=TTreeListViewAlignChild.Create;
Tree1.AssignParent:=True;
ChildEnCours := ChildExplorateur; // ChildEnCours is Tobject
end;
procedure TFrameEfcTree.BtExploClick(Sender: TObject);
begin
Tree1.Clear;
ChildEnCours := ChildExplorateur;
TreePrepareManager(Tree1, ChildEnCours );
end;
procedure TFrameEfcTree.BtLeftClick(Sender: TObject);
begin
Tree1.Clear;
ChildEnCours := ChildLeft;
TreePrepareManager(Tree1, ChildEnCours );
end;
But, in first test is OK, but if change 2 o 3 > exception !!
Change ChildManager at runtime
Re: Change ChildManager at runtime
Hi mivchart,
Could you please send us a simple example project we can run as-is to reproduce the problem here?
Thanks in advance.
Could you please send us a simple example project we can run as-is to reproduce the problem here?
Thanks in advance.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Change ChildManager at runtime
Ok, with sample project.
- Attachments
-
- ChildManager.zip
- Sample Example
- (32.92 KiB) Downloaded 1178 times
Re: Change ChildManager at runtime
Do you have solution for me, with example above !
Re: Change ChildManager at runtime
Hi mivchart,
Thanks for the project. We could reproduce the problem and we tried to analyse what's wrong but I'm afraid we couldn't find it.
I've added it to the defect list to be revised deeper so it can be fixed in future releases (TV52014798).
Thanks for the project. We could reproduce the problem and we tried to analyse what's wrong but I'm afraid we couldn't find it.
I've added it to the defect list to be revised deeper so it can be fixed in future releases (TV52014798).
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Change ChildManager at runtime
ok,
ok, I'll do differently in this case
ok, I'll do differently in this case
Re: Change ChildManager at runtime
Hi,
i have a solution to every change made in the format, you must recreate a ChilManger, without releasing the previous !
I think the release is done internally
It's simple and it works
I create a type to simplify my code
type TTreeFmtType=(TreeFmtExplo,TreeFmtTop,TreeFmtLeft,TreeFmtList);
//=======================================
procedure TFrameEfcTree.TreeChangeFormat;
begin
try
//change la Forme du Tree
case TreeFormat of
TreeFmtExplo: Tree1.ChangeManager(TTreeExplorerAlignChild.Create);
TreeFmtTop: Tree1.ChangeManager(TTreeTopBottomAlignChild.Create);
TreeFmtLeft: Tree1.ChangeManager(TTreeLeftRightAlignChild.Create);
TreeFmtList: Tree1.ChangeManager(TTreeListViewAlignChild.Create);
end; //case
except
On E:Exception do Showmessage(E.Message);
end;
end;
i have a solution to every change made in the format, you must recreate a ChilManger, without releasing the previous !
I think the release is done internally
It's simple and it works
I create a type to simplify my code
type TTreeFmtType=(TreeFmtExplo,TreeFmtTop,TreeFmtLeft,TreeFmtList);
//=======================================
procedure TFrameEfcTree.TreeChangeFormat;
begin
try
//change la Forme du Tree
case TreeFormat of
TreeFmtExplo: Tree1.ChangeManager(TTreeExplorerAlignChild.Create);
TreeFmtTop: Tree1.ChangeManager(TTreeTopBottomAlignChild.Create);
TreeFmtLeft: Tree1.ChangeManager(TTreeLeftRightAlignChild.Create);
TreeFmtList: Tree1.ChangeManager(TTreeListViewAlignChild.Create);
end; //case
except
On E:Exception do Showmessage(E.Message);
end;
end;