If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

CListCtrl limit 260 characters?

I have a CListCtrl and for some reason, if I type in more than 260
characters in a cell, it just acts really wierd. It starts shifting data
and just seems to cut off that cell at 259 characters. Any idea on
how to expand the number of characters a subitem in a CListCtrl
can hold?

Re: CListCtrl limit 260 characters?

Originally Posted by DanYELL

I have a CListCtrl and for some reason, if I type in more than 260
characters in a cell, it just acts really wierd. It starts shifting data
and just seems to cut off that cell at 259 characters. Any idea on
how to expand the number of characters a subitem in a CListCtrl
can hold?

Please, any response any one can give me will be greatly
appreciated.

Sincerely,
Danielle Brina (an overworked graduate student)

Frankly, I don't know CListCtrl - but, it does not make sense that the Control Limits string input length.

However, your observation that the number of characters supported are -

259 + 1 NULL CHAR = 260

seems ominous of a Character Array initialized to MAX_PATH or an equivalent.

Code:

#define MAX_PATH 260

And perhaps, your character buffer is something like this -

Code:

char strMyListBuf [MAX_PATH];

Please check this up! You must use a dynamically allocated buffer and not a statically allocated one!

Re: CListCtrl limit 260 characters?

Originally Posted by DanYELL

I have a CListCtrl and for some reason, if I type in more than 260
characters in a cell, it just acts really wierd. It starts shifting data
and just seems to cut off that cell at 259 characters. Any idea on
how to expand the number of characters a subitem in a CListCtrl
can hold?

The default text limit is 260 chars for the labels of a listview control. To change that, call SetLimitText() for the label's edit control when processing the LVN_BEGINLABELEDIT message:

Re: CListCtrl limit 260 characters?

the buffer i am moving to cChar comes from a CString namdecsAux that cotains a text that is no bigger than 2000 characters...so, it seems the cChar is not going out of scope....

Yes, it goes out of scope (when the block ends). You assign the address of the first character of cChar to pDispInfo->item.pszText (note that you could just as well write pDispInfo->pszText = cChar).
Then you copy the contents of csAux to the cChar buffer - why are you passing csAux.GetLength()+1 as the length, BTW?
After that, cChar goes out of scope, and pDispInfo->pszText points to a variable that no longer exists.

Re: CListCtrl limit 260 characters?

Originally Posted by adamenko

You may use the Long Path Tool to overcome this problem. I'm sure it will help.

I have no idea what "the Long Path Tool" is and how could it help the OP.
What I know exactly is one has to read the docs (MSDN) and implement bug-free code to not have the problems like OP had.
I use since a years list view controls with the item text lengths much more than standard MAX_PATH (260) symbols. Without any problem.
And I believe that both OP and wurzlmagda already had fixed their bugs (it was about 9 years back!) since this thread was sleeping all this time!