Watch, Follow, &
Connect with Us

Please visit our new home

Public Report
Report From: Kylix/VCLX/TTreeView    [ Add a report in this area ]  
Report #:  11628   Status: Withdrawn
Item Index Wrong Assignment
Project:  Kylix Build #:  3.0
Version:    3.0 Submitted By:   Francisco Silva
Report Type:  Issue Date Reported:  3/26/2005 9:01:39 AM
Severity:    Serious / Highly visible problem Last Updated: 3/26/2005 9:10:33 AM
Platform:    Kylix Pascal IDE Internal Tracking #:  
Resolution: None  Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
When I have a TreeView with some Items in it, if I try to Insert a new item the new Item gets the next available Index and NOT the NEXT Index of where I inserted. But if I call the AbsoluteIndex function I DO get the right Index. But the issue here is that the Absolute Index of an Item is NOT the same as the TRUE Index of the Item in the TreeView.

For example:

- one        (Absolute index = 0)
   - two        (Absolute index = 1)
   - three        (Absolute index = 2)
   - four        (Absolute index = 3)

now lets say that I want to Insert a new Item between "two and three"

- one        (Absolute index = 0)         real Index =0
   - two        (Absolute index = 1)      real Index =1
   - NewItem   (Absolute index = 2)      real Index =4
   - three        (Absolute index = 3)      real Index =2
   - four        (Absolute index = 4)      real Index =3

If I want to Access directly the "NewItem" I should type:
Caption := TreeVew1.Items[2].Text;
this should show the text of the newItem in the Form Title, but it dosn't, It will show the Text of the Item "three";
Steps to Reproduce:
Download the source code


Server Response from: ETNACODE01