Link to home
Start Free TrialLog in
Avatar of DevonportA1
DevonportA1

asked on

Probs with CListCtrl in report view

How do I insert text into the columns of a list control which is in report view.

I'm trying this function:
int InsertItem( const LVITEM* pItem);

LVITEM is the following struct which "specifies or receives the attributes of a list view item".

typedef struct _LVITEM {
    UNIT mask;
    int iItem;
    int iSubItem;
    UNIT state;
    UNIT stateMask;
    LPTSTR pszText;
    int cchTextMax;
    int iImage;
    LPARAM lParam;
#if (_WIN32_IE>= 0x0300)
    int iIndent;
#endif
} LVITEM, FAR *LPLVITEM;

Firstly, is this the right way to go about inserting text into the columns? Does each piece of text have one of these structures associated with it?

Secondly, when I try and compile this I get the following error on the line with UNIT mask:

"error C2059 : syntax error : 'constant'  

do you know what causes this?
Avatar of Zoppo
Zoppo
Flag of Germany image

Hi DevonportA1,

InsertItem is the correct way to insert text of first column, to insert text to further
columns you'll have to use CListCtrl::SetItemText(). Be aware that you have to
first insert the columns with CListCtrl::InsertColumn().

Maybe you'll find some other implementations of CListCtrl::InsertItem() easier to
use then the shown one.

About the error: could you post the exact code where this error occurs?

hope that helps,

ZOPPO

ASKER CERTIFIED SOLUTION
Avatar of Vinayak Kumbar
Vinayak Kumbar

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