Solved

search/find treeviewitem when only item label is known

Posted on 2003-10-22
7
560 Views
Last Modified: 2013-12-26
hi
I know the label(text) of a treeview item. how can i access that particular treeviewitem(all items populated from database) and change its properties(like make it bold).
thanks in advance
0
Comment
Question by:balakarthikeyan
  • 2
  • 2
7 Comments
 
LVL 2

Expert Comment

by:bluecomet
ID: 9597502
HI,

if your labels are unique it is simple. Go trough the hole treeview to pick your item an than you can use getitem and setitem with his itemhandle to change your item.
if your labels aren't unique you must go trought the hole treeview and check the data of your item to change it. Data must be unique.

or

when you click on an item you have his handle and you can get change it as mentioned above.

$regards
0
 

Author Comment

by:balakarthikeyan
ID: 9597678
hello
what you have told is the logic which i readily agree upon but the thing is i need the code. my application uses this treeview control to populate data(window titles) at runtime. on selecting a window title(treeviewitem) in the treeview i open the corresponding window in the mdi client area and make the treeviewitem name bold. I may have many windows open at a time.Now when i close any window, the windowname in the treeview should have the 'bold' face changed to regular.Hope you understand .So as you said can i loop thro the treeview and find a particular label .If so pls send me the code. thanks
0
 
LVL 2

Accepted Solution

by:
bluecomet earned 20 total points
ID: 9598557
If i understand well what you will do do the following:

declare an instance variable in each window which you call il_tv_handle which will contain the itemhandle of the label in your treeview of a window.
so when you click on an item in your treeview you will open the window and save the value.

event treeview.click()

 open(window_name)
 window_name.il_tv_handle = handle

----

on closequery of an opened window which will be closed do:

treeviewitem ltv_item

w_tv.tv.getitm(il_tv_handle,ltv_item)
ltv_item.bold = false
w_tv.tv.setitm(il_tv_handle,ltv_item)

hopes that is what you want

$regards
0
 
LVL 14

Expert Comment

by:sandeep_patel
ID: 9598566
hi,

i think there is no any such property for individual treeview items. the properties that you can use for the same stuff are picturename and statepicturename. Using it u will be able to identify which items currently user has selected.

-sandeep
0
 

Author Comment

by:balakarthikeyan
ID: 9604431
hi Bluecomet
      You were close to the answer.Having instance variables is ok.Your closequery event code is also right. But you cannot assign the handle to the instance variable using the method you have specified.ie window_name.instancevar = handle
This will return an "incompatible property for window" error.
Sorry yaar! And thanks for your valuable comments

hi sandeep_patel
   Your idea will definitely not work out. Anyway thanks for the response. Better luck next time

Dear Administrator
I think you can give partial points for bluecomet say 20 points. I have found the solution myself  by starting out from bluecomet's comments.Kindly close this thread and give me the remaining points.

regards
balakarthikeyan
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now