Link to home
Start Free TrialLog in
Avatar of sachelis
sachelis

asked on

Limit CListCtrl to one column when in LVS_SMALLICON mode

I have CListCtrl that displays text and small icons while in LVS_SMALLICON mode. Occasionally a short text string will result in two list items being displayed on the same row:
User generated imageI tried using CListCtrl::SetColumnWidth(), but it doesn't work when in LVS_SMALLICON mode. I tried using LVS_LIST mode and SetColumnWidth() which does fix this problem, but it then only has a horizontal scrollbar and puts information that doesn't fit in the list to the right (whereas I need one long column and a vertical scrollbar).

Thanks.
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

You could consider using a ListBox (not ListCtrl) instead - that only has one column.  (Except if you instruct it to use multi column that is).
Avatar of sachelis
sachelis

ASKER

THanks Andy, but list boxes don't support icons (I'd need to do an owner draw which requires signifiantly more code).
Yeah, but I don't think what you want is possible - at least not without a lot of code either.
SOLUTION
Avatar of sarabande
sarabande
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
See the explantion for why this, and Sara's, solutions both work. My solution was easier to implement, because our code was already based on a small icon list.