Page 1 of 1

Poss Ttree image index bug

Posted: Sun Jan 30, 2005 9:48 pm
by 9336311
Hi

I had to change the source code of teetree by dding the line shown below,
because when I assign a image index to a tree node, the image is correctly assigned but the image index itself never
changes and I need to know the image index later so I made a small change in
their code (added line 6788).

Rgds

Peter

procedure TTreeNodeShape.SetImageListIndex(const Value:Integer);
begin
if FImageListIndex<>Value then
begin
FImageListIndex:=Value; // just set the variable. Do not free FImage.
FreeAndNil(FImage); //tom:01/09/2002 Otherwise Images are drawn on top of each other...
RecalcImageSize;
// line 6788 added
FImageListIndex:=Value; // the above line resets the ImageListIndex (!)

CanvasChanged(Self);
end;
end;

Posted: Wed Mar 09, 2005 2:13 pm
by Tom
thanks for the bug report, we will look at it and take it into account in one of the next releases

ImageListIndex does not update

Posted: Mon Mar 14, 2005 6:09 pm
by 7729873
I had a similar problem, but I've recompiled the source and my code now works like a charm. Thank you Peter for posting this kind advice.

Re: Poss Ttree image index bug

Posted: Wed Oct 06, 2010 4:34 pm
by 16557433
The latest version still has this problem.

Re: Poss Ttree image index bug

Posted: Fri Oct 08, 2010 11:40 am
by narcis
Hi Cyionics,

I'd like to apologise for the lack of response here. Could you please attach a simple example project we can run "as-is" with which we can reproduce the problem here and we will investigate it and try to apply the fix you suggested?

Thanks again for your collaboration.

Re: Poss Ttree image index bug

Posted: Wed Oct 13, 2010 3:06 pm
by 16557433
Here is a program that creates two tree nodes and assigns 0 and 1 to their ImageListIndex properties, respectively, in the form's OnCreate. When you click the button it reads the ImageListIndex property of the first node, and it returns -1 even though the image is correctly set.

TTreeNodeShape.SetImageListIndex calls RecalcImageSize and that procedure (by calling some other procedures) causes the FImageListIndex variable to be reset to -1.

Re: Poss Ttree image index bug

Posted: Thu Oct 14, 2010 10:41 am
by narcis
Hi Cyionics,

Thank you very much for your project. I have checked your solution proposal solves the issue. We will investigate a little bit further and consider it for inclusion in the next maintenance release.