Native CheckedListBox? - c++

In .NET land, there's the tremendously useful System.Windows.Forms.CheckedListBox class.
What is the equivalent in Windows Common Controls land? (if any)

Turn a list view into one with checkboxes. If you want it similar to a ListBox, only use 1 column.
ListView_SetExtendedListViewStyle (handle, LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT);

Almost identical UI can be developed with the List View control by using item state images.
But selection management and other functionalities need to be implemented manually.

This article might be of interest for you. In short windows allows quite easily to implement checkboxes in Listbox and combobox through custom drawing and messaging.

Related

Menu designed for use without mouse. What is the best way to implement?

I'm writing a GUI using QT for embedded system with linux. This device has no mouse. Only display and specific keyboard with keys: up, down, return and 7 number keys.
The software will be used to set some parameters of device and read them (some charts also).
Example of how menu could look:
after OPTION 1 selected
After SUBOPTION 1 selected some table with data is loaded.
Sometimes after selecting option i need to load specific widget and sometimes just another set of options.
I think it is possible to implement custom labels and kind of list widget that aligns them.
I guess it is also possible to use Qt's MVC classes for it. They are highly customizable, but i never made custom views and delegates.
Maybe i just need to create QtListView with stringlist model and apply stylesheet to it so it gets look more like buttons. And based on selection in list load next widget.
Which way is better and why?
Is there any easier ways to accomplish this?
Any ideas would be appreciated.

Is it possible to create multi column combobox by subclassing only its listbox?

In MFC, is it possible to create multi column combobox by subclassing only its listbox.
In Codeproject and Codeguru websites I got samples only with derived CComboBox with ownerdraw style.
The "list" part of a combo-box control is NOT a list-box control. Apart from this, combo-box controls do not really have "columns", and this means that you cannot store column-level data (there is just one string or "item" per row), and subsequently any solution visually imitating "columns" can only be owner-drawn-based. So, if your app's specs have changed (now requiring column formatting) you should rather consider using another control type. Still, an owner-draw implementation isn't really that hard, esp if you have fixed height items; it shouldn't really require extensive changes to your app, as it concerns this specific control only.

Nondynamic Doc/View Architecture Usage in MFC

I have a problem in which there is bunch of data that will be displayed in two different ways and they should always be synchronized with data . Logically i thought of exploiting the Doc/View architecture on which mfc is based .
However The usage of MFC Doc/View architecture imposes the dynamic creation of document , view class by the Framework which is sth i don't want since i have to create the views myself within tab controls and DockablePane . Is there a workaround which let me take benefit of the Doc/View archiecture so i can create a view and corresponding document without the usage of dynamic creation by frameowrk ? sth like the qt's model/view technology !
What you want can be done within the MFC doc/view framework. It just takes more study. You can prevent MFC from creating a view at new document by passing NULL as the view class to AddDocTemplate. Then you can create views where you like using MFC's dynamic creation, specifically the CreateObject method. See the MFC source code for CSplitterWnd::CreateView as an example.
Yes, you can create two different views of the same document. If you always want both, the method MFC supports the most directly is a window with a static splitter, so you have one view in each pane of the splitter.
It's not (at all) clear what dynamic creation has to do with any of this though.

how to scroll lock first column of a report style listview in C++

I want to lock the first column of a report style listview from scrolling horizontally. I'm programming in C++ using Win32 (no .NET). This functionality does not appear to be available in the standard listview. Any suggestions on how this can be accomplished with C++/Win32? I've seen the suggestion of using a DataGridView in .NET, but I'm not using .NET...
Thanks
About the only thing I can think of is to use two abutting listview controls, one with the single column that never scrolls and the other with all the other columns. Not an ideal solution but there's no way to make the standard listview behave this way.
Alternatively, you could just write your own listview-like control.

Does MFC have a built in grid control?

First what I want: The ability to display a grid with multiple columns, each cell having a custom render callback. So you might use such a control to display your inventory in a game, or something like the behaviour in Google Chrome where it shows a grid of popular pages you visit.
I've been playing with CListCtrl and while I can get custom rendering ability on each item, I can't get it work with columns - having say 3 items per row. The control has column-related methods but I think these are specifically for the built-in functionality where different attributes of an item are shown automatically in each column... not for providing a generic grid control.
So, does such functionality exist in MFC? If not then I wonder if the easiest approach is for me to actually insert each of the rows as an Item... and then the custom rendering draws the multiple cells in the row, I could also do custom UI to support clicking on the cells.
But what I really want is to be able to create a custom control, and add this as an item to a list - like in Flex for instance - so I/O etc is automatically handled.
Any advice/information welcome...
Dundas has thrown some of its (excellent) components in the public domain. Their Ultimate Grid is available on CodeProject.
I'm not aware of a built-in control, but I think you should take a look at this.
The article is describing in detail the functionality of a fully featured MFC grid control, derived from CWnd, for displaying tabular data.
YOUR_LIST_CONTROL.SetExtendedStyle(LVS_EX_FULLROWSELECT|LVS_EX_INFOTIP|LVS_EX_GRIDLINES);
I think it will help you (SetExtendedStyle).
I suggest this one:
https://code.google.com/p/cgridlistctrlex/
very complete