how to scroll lock first column of a report style listview in C++ - 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.

Related

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.

Possible for ListCtrl Colspan, or similar functionality?

Is there a way to have a ListCtrl cell span several columns? Or perhaps to able to append a panel / other element to a ListCtrl item that will contain the info I need?
No. The ListCtrl does not support that functionality. There is a pure Python list control widget called the UltimateListCtrl that allows you add any widget to a cell, although it doesn't appear to allow cell spanning either. I would still try this widget and see if it works for you. If it does not, you may be able to patch it yourself because it's written in Python or you could do a feature request for it to be added to the UltimateListCtrl on the wxPython mailing list and see if anyone takes you up on it.
You can do spanning in a wx.Grid widget if you wanted to go that route, although it's pretty limited when it comes to embedding other widgets.

Is there any other control like ListView in win32 or if there is any way to remove the title area of the ListView control which is available in win32

Is there any other control like ListView in win32 or if there is any way to remove the title area of the ListView control which is available in win32. And can this be used for text formatting like tabs and bold, italics.
Thanks in advance :)
If you want text-like features then use rich edit control.
If you want to show list view control in report view without header then include LVS_NOCOLUMNHEADER style when creating the control.
yes, the column header doesn't have to be visible at all. It can format each item individually too like bold, but tabs are best implemented as columns (without the header visible of course).
Without knowing more what you want, its difficult to advise.

Native CheckedListBox?

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.

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