CListCtrl: single column without column headings? - list

If I set View = Report, then you get a single column and a vertical scrollbar (what I want). However you also get an area at the top reserved for column headings even if you don't have column headings (not what I want).
If I set View = List, then no screen space wasted for column headings (what I want) but there are now multiple columns and a horizontal scrollbar (not what I want).
I think I'd be happy if I could use Report mode but just somehow shrink the space reserved for the column headings to zero. Any ideas?

I think you are searching for CListBox. See here for more.
If you would like to continue with CListCtrl then use List view or Small Icon instead of Report view. For more see here.

Related

Qt scrollbar pushes table inwards?

I have made a window in Qt C++ where inside I fill a table with items row by row. However, after I fill out enough rows, a scrollbar appears in order to allow me to scroll the extra rows. The problem is - when the scrollbar appears, it squeezes the table inwards. Is there some way to prevent this from happening?

QTableWidget show scroll bar

I would like the horizontal scroll bar to appear whenever there is text eliding. Such that the user won't have to resize the whole GUI. How would I do this?
This is what I have coded:
ui->tableWidget->horizontalHeader()->setStretchLastSection(true);
ui->tableWidget->horizontalHeader()->setSectionResizeMode(1,QHeaderView::Stretch);
ui->tableWidget->resizeColumnsToContents();
I also tried enabling scrollbar to appear always, but scrolling to the very right doesn't do anything.
If I set textElideMode to ElideNone , the text from the 2nd column is partially hidden and no scrollbar appears.
QHeaderView::Stretch will stretch the column width to the available space. Use QHeaderView::ResizeToContents to make the column wide enough to display the content, resulting in a horizontal scroll bar if necessary.
This will have a couple of side effects of which I'm not sure you want them.
There will probably be no more ellipsis in the elided text.
If all of the values in your Hash column are very small, then that column will be very thin, so there might be 'empty' space next to that column.

Infragistics Ultragrid Design Mode Keeps Adding RowScrollRegions

I've got a multi-band ultragrid with an ultragridrowedittemplate per band.
In Design view the ultragrid is showing several horizontal lines - which can each be dragged downwards to show a view of the ultragrid bands. After much searching I discovered they are row scroll regions and I've added in some code into the form initialisation procedure to remove these row scroll regions.
That was fine at first, but the ultragrid, over time has added more and more row scroll regions to itself - and when the application is now loaded it takes more and more time for the code to run to remove all these regions.
Is there a setting in the Design mode that stops these row scroll regions being added? I haven't noticed a pattern to when they are added. If someone could explain/help this will be much appreciated!
Thank you
In design mode drag the divider to the top of the grid to remove them. To create them there should be a handle just above the scroll bar that you can grab and drag down. If you want to prevent them from being created at design time or run time, set DisplayLayout.MaxRowScrollRegions to 1.
Note that you may also want to set DisplayLayout.MaxColScrollRegions to 1 as well if you don't want either row or col scroll regions. To remove ColScrollRegions, drag the divider to the left of the grid to remove them. There is a handle to the left of the scroll bar if you want to add them back.

Controlling width/layout in CListCtrl (Icon view)

Apart from the fact I still can't see why this class fills columns and scrolls horizontally, rather than filling rows and scrolling vertically, I'm confused how the width of items is controlled. I'm seeing quite a lot of padding (50-80 pixels) between the longest item in a column and the next column which means wasted space.
Is it controllable?
Somebody else asked about scrolling, here is the answer.
If you are referring to column width then you can change it using:
CListCtrl list;
list.InsertColumn(0, _T("Column1"));
list.InsertItem(0, _T("Item with a long name"));
list.SetColumnWidth(0, LVSCW_AUTOSIZE_USEHEADER);

How to edit columns in-place with CListCtrl?

I want to have CListCtrl.EditLabel() for any column of the list. How can I implement such a feature?
This is doable but it does require a fair bit of stuffing around with mouse clicks and focus events.
In a nutshell you trap the left mouse button down message and convert it into a cell hit details (i.e a row and column index).
With these cell details you can not determine the size and location of the list view cell and also the text value that it contains.
Now create a CEdit control directly over this cell by using size and location details from the previous step and give it the text value of the cell.
The final step is to handle the focus and keyboard enter events for the CEdit so that the text details of the CEdit can be put back into the list view cell.
It does take a fair amount of coding but when done right it does work well as an alternative to a grid control.
Don't attempt with CListCtrl.
Use the MFC Grid Control. We deploy it in an off-the-shelf app with success. It offers in-place edit, checkbox, spin, etc for all cells, as well as column and row headers, auto-size, auto-expand, colors, drag-drop.