Anyone an idea?
Danny Springer
What code are you using to insert the item?
--
Charles Calvert | Software Design/Development
Celtic Wolf, Inc. | Project Management
http://www.celticwolf.com/ | Technical Writing
(703) 580-0210 | Research
Charles Calvert wrote:
> On Mon, 30 Dec 2002 22:27:43 +0100, Danny Springer <d...@knoware.nl>
> wrote in <3E10BA4F...@knoware.nl>:
>
> >I have an SDI application based on CListCtrl in reportview. I want my
> >icons to appear in the third column, after searching a long time I found
> >the extended style LVS_EX_SUBITEMIMAGES and now I the icon appears in
> >the column where I want it. There is only one problem left, it also
> >appears in the first column.
>
> What code are you using to insert the item?
LV_ITEM lvItem;
// the first column without an icon
lvItem.mask = LVIF_TEXT;
lvItem.iItem = 0;
lvItem.iSubItem = 0;
lvItem.pszText = "Danny";
InsertItem(0, "");
SetItem(&lvItem);
// the second column with an icon
lvItem.mask = LVIF_TEXT|LVIF_IMAGE;
lvItem.iItem = 0;
lvItem.iSubItem = 1;
lvItem.pszText = "Springer";
lvItem.iImage = 0;
SetItem(&lvItem);
// the third column without an icon
lvItem.mask = LVIF_TEXT;
lvItem.iItem = 0;
lvItem.iSubItem = 2;
lvItem.pszText = "15-09-1959";
SetItem(&lvItem);
Other rows are the same (with other text and icons ofcourse). Column 0 always
shows icon 0. Any idea?
Happy new year,
Danny Springer
It sounds like it might be by design : From CListCtrl Overview
Report view
Each item appears on its own line, with additional information arranged in
columns to the right. The leftmost column contains the small icon and label,
and subsequent columns contain subitems as specified by the application. An
embedded header control (class CHeaderCtrl) implements these columns. For
more information on the header control and columns in a report view,
seeUsing CListCtrl: Adding Columns to the Control (Report View).
Pay attention to the second sentence.
dave h
>Charles Calvert wrote:
>
>> On Mon, 30 Dec 2002 22:27:43 +0100, Danny Springer <d...@knoware.nl>
>> wrote in <3E10BA4F...@knoware.nl>:
>>
>> >I have an SDI application based on CListCtrl in reportview. I want my
>> >icons to appear in the third column, after searching a long time I found
>> >the extended style LVS_EX_SUBITEMIMAGES and now I the icon appears in
>> >the column where I want it. There is only one problem left, it also
>> >appears in the first column.
>>
>> What code are you using to insert the item?
>
>LV_ITEM lvItem;
>
>// the first column without an icon
>lvItem.mask = LVIF_TEXT;
>lvItem.iItem = 0;
>lvItem.iSubItem = 0;
>lvItem.pszText = "Danny";
>InsertItem(0, "");
>SetItem(&lvItem);
You're not setting lvItem.iImage here. You should either initialize
lvItem using ZeroMemory() or memset() or set each an every member
individually before using it. If you don't, there's no guarantee that
you won't be passing bogus values.
In this case, try setting it to I_IMAGECALLBACK. That will cause the
ListView to treat it as a callback. If your program doesn't handle
the LVN_GETDISPINFO message, then no icon will be drawn for that item.
Note that a blank space the size of an icon will appear, however. I
don't know of a way to eliminate that without doing custom or owner
drawing.