Click here to Skip to main content
13,050,617 members (83,456 online)
Rate this:
Please Sign up or sign in to vote.
See more:

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 11-Jan-11 14:29pm
Amir Mahfoozi 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 :)

Espen Harlinn
SAKryukov 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 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
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 17 Oct 2011
Copyright © CodeProject, 1999-2017
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