Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 581
  • Last Modified:

search/find treeviewitem when only item label is known

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
balakarthikeyan
Asked:
balakarthikeyan
  • 2
  • 2
1 Solution
 
bluecometCommented:
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
 
balakarthikeyanAuthor Commented:
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
 
bluecometCommented:
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
 
sandeep_patelCommented:
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
 
balakarthikeyanAuthor Commented:
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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now