-
April 4th, 2005, 11:15 AM
#1
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?
Please, any response any one can give me will be greatly
appreciated.
Sincerely,
Danielle Brina (an overworked graduate student)
-
April 4th, 2005, 11:22 AM
#2
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!
Last edited by Siddhartha; April 4th, 2005 at 11:25 AM.
-
April 4th, 2005, 11:28 AM
#3
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:
Code:
void CTestDlg::OnBeginlabeleditListTest(NMHDR* pNMHDR, LRESULT* pResult)
{
LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
CEdit* pEdit = m_listTest.GetEditControl();
ASSERT(pEdit);
pEdit->LimitText(1024); // Set the new limit to 1024 chars
*pResult = 0;
}
-
April 4th, 2005, 11:36 AM
#4
Re: CListCtrl limit 260 characters?
Originally Posted by gstercken
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
I have made a faux-pas in my post above.
Thanks for pointing it out!
-
April 4th, 2005, 11:44 AM
#5
Re: CListCtrl limit 260 characters?
Originally Posted by Siddhartha
I have made a faux-pas in my post above.
Thanks for pointing it out!
No problem...
-
July 25th, 2005, 01:41 PM
#6
Re: CListCtrl limit 260 characters?
I need your help regarding ClistCtrl and it has to do with the length of columns…
When creating a CListCtrl even though I set cchTextMax to for example 2000, when the method that handles the LVN_GETDISPINFO is called, the cchTextMax is always set to 260.
Even if I set a new buffer to pszText and set cchTextMax to 2000, when displaying the column the data presented is truncated to 260.
How to display a column with length bigger than the default of 260 characters?
Thank you for all your help!
magda.
-
July 25th, 2005, 02:01 PM
#7
Re: CListCtrl limit 260 characters?
Use LPSTR_TEXTCALLBACK to associate item text this will use your buffer to hold text and it should fix it. I have never seen the 256 limit for myself though or I am unaware of.
Good Answers, Good Points.
-
July 25th, 2005, 02:54 PM
#8
Re: CListCtrl limit 260 characters?
Thank you for your reply!
I am using LPSTR_TEXTCALLBACK when creating my list, and in the method that handles the LVN_GETDISPINFO, I am doing the following:
void CListCtlTestDlg::OnGetdispinfoList1(NMHDR* pNMHDR, LRESULT* pResult)
{
LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
if (pDispInfo->item.mask & LVIF_TEXT)
{
:
:
:
char cChar[2048];
memset(cChar, '\0', 2000);
pDispInfo->item.pszText = &cChar[0];
pDispInfo->item.cchTextMax = 2048;
lstrcpyn(pDispInfo->item.pszText, csAux, (csAux.GetLength()+1));
}
:
:
*pResult = 0;
}
but the data is still being presented truncated at 260 characters.
magda.
-
July 25th, 2005, 02:57 PM
#9
Re: CListCtrl limit 260 characters?
If this is your exact code, the character buffer is going out of scope.
Arjay
-
July 25th, 2005, 04:59 PM
#10
Re: CListCtrl limit 260 characters?
Hi,
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....
I am confused...
magda.
-
July 25th, 2005, 05:22 PM
#11
Re: CListCtrl limit 260 characters?
Originally Posted by wurzlmagda
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.
-
July 25th, 2005, 05:41 PM
#12
Re: CListCtrl limit 260 characters?
even by solving the out of scope, the data presented is still limited to 260 even though cchTextMax is being set to 2048…
can you help me with the 260 limit???
Thank you for all your replies,
magda.
-
June 1st, 2006, 11:45 AM
#13
Re: CListCtrl limit 260 characters?
Does this apply to your question ?
MSDN - bug report
-
June 18th, 2014, 07:02 AM
#14
Re: CListCtrl limit 260 characters?
You may use the Long Path Tool to overcome this problem. I'm sure it will help.
-
June 18th, 2014, 07:30 AM
#15
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!
Victor Nijegorodov
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|