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

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?

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.

Related

Sitecore: Render content tree child items as list view

Is it possible to change the way items in the content tree are rendered in Sitecore?
In Umbraco, there's the option to render all child items of a parent node as either child nodes or in a list view outside of the tree. Next to the tab(s) belonging to the parent node, a node "child items" is added. In this node, all child items are rendered in a listview, supporting popular features like paging, sorting and search.
Is this possible in Sitecore?
Upon searching for an answer to this question, the most common reply is to use a bucket. However, when using a bucket, a message appears instead of the child nodes: "There are hidden items in this container". In a new tab next to the standard Content tab, the end user can search for a child item, but it doesn't seem to be possible to show a listview/grid.
So the question remains:
Can we render content tree subitems in a list/grid, in a new tab next to the Content tab, using features like paging and sorting.
Many thanks.
You can define a default query for your bucket. After that, when a user clicks on the bucket item, he will see search results right away in the form of a list.
Here's documentation on how to do this:
https://doc.sitecore.net/sitecore_experience_platform/setting_up__maintaining/search_and_indexing/create_a_default_and_a_persistent_search_query
In short, you just specify your query in the field Default bucket query of the bucket item.
I am not aware of any other way of achieving what you want. Sitecore content editor just doesn't have this feature from Umbraco.
You may want to take a look at the Subitem Express module.
It does not offer features such as a sorting, paging or searching, but it will display and allow editing of children from a single content editing pane, as well as allowing adding new and deleting children. The child items can also be hidden so that they are not visible in the tree by default, but you can enable "hidden items" to still edit the children like regular items.
Really depends on your requirements, but I've used the module for data heavy items where it was easier to enter through the Content Editor than all the fluff around the Experience Editor to speed data entry.

TFS Allow all states for a work item

Is it possible to open up all possible states for a work item - essentially removing the state transitions?
I am hoping to use a tool outside of TFS for managing work items and would like to know if it's possible to simply allow all states at any time?
If you want to remove the transitions between work item, you need to customize the work flow.
You change the workflow to accomplish the following objectives:
Add or remove a state, reason, or transition.
Specify a value for field to be applied during a change in state,
reason, or transition..
Specify a custom ACTION to automate field assignments based on a
change in state, reason, or transition.
Detail steps to customize the workflow and more info about it, please refer this Modify or add a custom work item type (WIT) from MSDN.
Moreover, here is a 3rd party extension called TFS Work Item Manager which is an innovative team workload coordination platform that helps you manage your TFS work items in a much more efficient and intuitive way. You can also take a look at it.

Sitecore Custom Multilist

In Sitecore, I built two custom multi-lists, where the second one depends on the first. The only issue is, that after selecting the first one, I have to save the item before the second multi-list filters the items.
My question somebody know how to create a two custom multi-list on Sitecore, where the second one filters automatically after selecting an item in the first (without save event), or which event can I override to do it?
It sounds like what you are looking for is some kind of front end event that you can use in the Sitecore backend to update a list based on another list selection without a save event. I don't think there is really anything out of the box for that..
Really what you should be doing (to do the 'sitecore' thing) would be to have your first selection (be it multi-list or whatever you like) simply point to a datasource item for another template item which is where your user can set the second option(s). I think you would benefit from taking a different approach like this rather than trying to customise Sitecore here.

C++ MFC - CTreeCtrl - Difference between SelectItem and SetItemState

I need to create a Tree List for my windows application, with multiple selection of nodes with drag-and-drop support. Since Microsoft doesn't provide any such property for the tree which eases the work of the developer, I have to implement this features on my own.
Can somebody explain me the differences (also, the corresponding getters for the following statements) and when to use
SetItemState(hItem, 1, TVIS_SELECTED);
and
SelectItem(hItem);
and
SetItemState(hItem, TVIS_SELECTED, TVIS_SELECTED);
The primary difference is that SelectItem is functionally built off of SetItemState. Along with anything else it does, SelectItem will use SetItemState (or equivalent internal calls) to set TVIS_SELECTED for the new item, and, say, remove it from the previously selected item.
In order to implement your own multiple-selection control, you have to prevent SelectItem from being called when you want to augment the selection instead of replacing it. There are a lot of cases to consider, ranging from mouse clicks with various modifier keys held to keyboard navigation, so good luck in your implementation!

Unlimited number of checkboxes

I wonder how to create mechanism which create new checkbox below previous when you click on button. Number of checkboxes are unlimited.
I don't think that table of objects work well, so I think about implementation in list of objects.
Any suggestions?
Here is what I would do:
Create an event for clicking that button (let's call it OnBtnClick)
Use a vector/list to hold all the checkboxes
When OnBtnClick is called you do:
create a checkbox with the desired position and size and make sure it receives an unique id (this will help you differentiate between checkboxes when they are clicked/checked/etc).
add the checkbox to the list (to get its status: checked or not checked)
add the checkbox to the desired window, the parent window (though this may happen automatically when you create it)
if you want to add an event for the added checkbox you should check the manual of your GUI framework (you will probably use the same event handler for all checkboxes and treat them separately based on their id)
Depending on the GUI framework used the bottom details may vary but the idea remains the same. I did this with wxWidgets, QT and MFC but I don't know which framework you use. You should be able to find code samples for each framework.
What would you do with unlimited number of check boxes - confuse the user? So, that he/she wouldn't attempt to use it again? Bad idea, as you can guess now.
You may (should) limit the number of check boxes (or better, limit the number of controls on form/dialog). IMO, more than 10-12 CBs would be cumbersome for the end user. Therefore, better idea is to have all of them on dialog/dialog-resource, and make all of them invisible/disabled. When user does some action, make them visible/enabled - so that end user may do something with it.
Still demand N number of CBs, where N is not determined beforehand? Then you may have checkboxes under Combo box, or use check-boxes under List Control. List Control already hosts this feature, but for CBs under Combo, you may need to write your own class.See this article as an example.