jsist
jsist

Reputation: 5253

How to set Tree View item as visible/invisible using Win32 api

I am working on a project implemented using WIN32 APIs, where I need some of the tree-view items at run time to be visible/invisible, based on some data entered by user. I have done some work, where I found that I can add/delete item in a tree-view control but can't find anywhere how to set item visible or invisible(I found some examples where it can be done through MFC).

I am looking for the way to set them as visible/invisible is simply because when I add an item, it requires significant back-end calculations, that repeated addition or removal will result in performance issues. I only want to do that calculation only once per tree view item.

One of the solution, I have thought, if setting tree-view item is not possible, is to simply have a linked list of tree-view items present, and add/delete only those items that are required to be visible/invisible.

Please, tell me if it is possible to set tree-view item's state as visible/invisible, If yes, then how? And if no, what can be other alternate solutions?

Upvotes: 3

Views: 1599

Answers (1)

Remy Lebeau
Remy Lebeau

Reputation: 596833

The standard TreeView control does not have any concept of node visibility. Adding/deleting nodes is the only option. You will have to maintain a separate linked list cache of data that the nodes display (which you should do anyway so you separate your UI logic from your business logic). Otherwise, you need to write your own TreeView control, or find a third-party implementation, that suites your needs.

Upvotes: 6

Related Questions