CEdit - Possible bug
Hi,
I've been trying to get CListCtrl to change the number of characters a CEdit control can display to 2048. What I've tried to do is this:
CEdit *pReturn = mList.EditLabel(nItem);
pReturn->SetLimitText(2048);
BUT...after the double click function occurs, the length of the edit box is still 256.
Does anyone else have a clistctrl that returns a CEdit box with a editable box that has enough scroll room?
john
[473 byte] By [
warrenjo] at [2007-11-15 22:24:30]

# 1 Re: CEdit - Possible bug
Hi,
you're using the wrong function or let me see there is one function missing...
CEdit::SetLimitText(UINT nMax);
sets the text limit for this object. It is the maximum amount of text, in bytes, that the control can accept.
CEdit::LimitText(int nChars = 0);
limits the length of the text that the user may enter into the control.
The following should do what you expect
CEdit *pReturn = mList.EditLabel(nItem);
pReturn->SetLimitText(2048); // Set the limit the control can accept
pReturn->LimitText(2048); // Set the limit the user can enter
I don't know the value for the standard text limit a control can except so it might be more safe to set them both...
Ciao, Andreas
"Software is like sex, it's better when it's free." - Linus Torvalds
# 2 Re: CEdit - Possible bug
Still doesn't seem to work.
Here's how it works. I get a notification of a label edit from here:
ON_NOTIFY(LVN_BEGINLABELEDIT, IDC_CMD_LIST, OnBeginlabeleditCmdList)
My code to handle the information is here:
CListCtrl::OnBeginLabelEdit(NMHDR* pNMHDR, LRESULT* pResult)
{
HWND hWnd=(HWND)m_ctlList.SendMessage(LVM_GETEDITCONTROL);
ASSERT(hWnd!=NULL);
VERIFY(m_Edit.SubclassWindow(hWnd));
m_pEdit->SetLimitText(2048);
m_pEdit->LimitText(2048);
*pResult = 0;
}