Click here to Skip to main content
11,813,379 members (69,765 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: Delphi

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 8:25am
Espen Harlinn at 11-Jan-11 14:29pm
Amir Mahfoozi at 17-Oct-11 7:47am
Rate this: bad
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 | :)

Espen Harlinn
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:
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Obviously you compare
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;

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

  Print Answers RSS
0 Abhinav S 270
1 CHill60 180
2 KrunalRohit 154
3 Palash Mondal_ 145
4 Sergey Alexandrovich Kryukov 140
0 OriginalGriff 3,877
1 KrunalRohit 2,496
2 CPallini 2,240
3 Maciej Los 2,205
4 ppolymorphe 1,750

Advertise | Privacy | Mobile
Web04 | 2.8.151002.1 | Last Updated 17 Oct 2011
Copyright © CodeProject, 1999-2015
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