Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Delphi
hello
 
i try to write programm in delphi 2010 that like an dictionary but i have problem in my programm when i type in editbox my typed text search string in treeview nod text and automatically select that or when i type char 'A,a' treeview return node text that start with that char
 
i write program with Search button but i must type complete word to select that text what i was doing ?
Posted 11-Jan-11 9:25am
Comments
Espen Harlinn at 11-Jan-11 14:29pm
   
eehh?
Amir Mahfoozi at 17-Oct-11 7:47am
   
:-&
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

By guessing wildly I would say you are trying to implement an incremental search through the elements of the tree.
 
Virtual Treeview component[^] does that so well that reimplementing it using the standard "slow" TreeView is a vaste of time.
 
Virtual Treeview really is a gem, it's a total reimplementation and enormous improvement on the standard TreeView - It's also open source Smile | :)
 
Regards
Espen Harlinn
  Permalink  
Comments
SAKryukov at 11-Jan-11 16:31pm
   
Espen, wow, you know Virtual Tree View? -- my 5.
I used to use it in Delphi (actually, I only really valued Ada, Object/Delphi Pascal and C#) and it really helped. There are some minor problems, though. I also had my Unicode support I had to patch Virtual Tree View all the time (only my Unicode method really worked with non-Unicode VCL, published in "The Delphi Magazine").
Don't you know, still no Virtual Tree View for .NET? Would be a great assert...
I you know anything, will you please let me know (or even write an article)?
Espen Harlinn at 12-Jan-11 3:43am
   
The XtraTreeList control by DevExpress has many similarities, including performance, take a look at: http://www.devexpress.com/Products/NET/Controls/WinForms/Tree_List/
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Obviously you compare
node.text
with your search term exactly.
 
you should do something like this :
 
for cnt := 0 to TreeView1.Items.Count - 1 do
  if Pos(lowercase(Search.Text), lowercase(TreeView1.Items[cnt].Text))>0  then
   Node.Selected = true;
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 400
1 Jochen Arndt 190
2 Richard MacCutchan 135
3 DamithSL 95
4 Garth J Lancaster 90
0 OriginalGriff 6,045
1 DamithSL 4,601
2 Maciej Los 4,032
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,220


Advertise | Privacy | Mobile
Web03 | 2.8.141220.1 | Last Updated 17 Oct 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100