View previous topic :: View next topic |
Author |
Message |
floele
Joined: 04 Aug 2008 Posts: 22
|
Posted: Fri Dec 05, 2008 2:13 pm Post subject: Select a row by typing |
|
|
Hi,
is it possible for the user to change the row selection by typing in the list? (Well, I tried it and it doesn't work. But maybe there is a property I can set?)
I'd prefer it to be like in Windows Explorer where you can type the first part of a file name to jump to the corresponding item in the list.
Thanks in advance for any advice. |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Fri Dec 05, 2008 10:02 pm Post subject: |
|
|
Virtual Tree is optimized to work with very large data sources. The only way to implement this type of feature within Virtual Tree itself would be to iterate through every row of the tree and load data for each. For large trees this can potentially be very slow. If you need this feature then you can handle the KeyDown event and process it yourself. _________________ Infralution Support |
|
Back to top |
|
|
floele
Joined: 04 Aug 2008 Posts: 22
|
Posted: Sat Dec 06, 2008 10:20 am Post subject: |
|
|
How would I iterate through each row? More specifically, I'd in fact only need the values of the first column.
I know that it *could* be slow, but this kind of searching does still work very well with the standard virtual ListView and many thousand items. |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Sun Dec 07, 2008 12:51 am Post subject: |
|
|
The best way would be to work with the data source directly (ie not through Virtual Tree) and locate the data item you wish to move to. Then use the FindRow or GetRow methods to locate the Row in the VirtualTree and set FocusRow to this Row. That way VirtualTree does not have to retrieve all the data and create visual representations of rows that may never be displayed. _________________ Infralution Support |
|
Back to top |
|
|
floele
Joined: 04 Aug 2008 Posts: 22
|
Posted: Sun Dec 07, 2008 2:10 pm Post subject: |
|
|
Hm, is there a simple way to get the value of a given object for a column of your choice? If I want to keep this functionality generally usable, I can't do a switch() for the column and then check the property of my objects. |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Sun Dec 07, 2008 10:56 pm Post subject: |
|
|
If you want it to be completely generic then you may have to work through Virtual Tree and iterate over the child rows of the RootRow object by calling RootRow.ChildRowByIndex for each index. You can then use the RowBinding to get the CellData for the required column. Something like:
Code: | for (int i=0; i < vt.RootRow.NumChildren; i++)
{
Row row = vt.RootRow.ChildRowByIndex(i);
RowBinding binding = vt.GetRowBinding(row);
CellData cellData = new CellData(column);
binding.GetCellData(row, column, cellData);
string text = cellData.GetText();
} |
_________________ Infralution Support |
|
Back to top |
|
|
|