Link to home
Start Free TrialLog in
Avatar of knewton76
knewton76

asked on

Rich edit (CRichEditCtrl) & SetWindowText

I've got a rich edit control that I'm trying to set to a CString.  Actually, I've got it to work, except that the string itself can only hold as many characters as initially available.  Here's the code from my view with the CRichEdit:

CFtpDoc* pDoc = (CFtpDoc*)GetDocument();
m_richEdit.SetWindowText(pDoc->m_strText);

I can delete & change text, but say if I had 300 characters and deleted 5, I'd be able to add only 5 characters back in the editor.

Can anyone help?
Avatar of captainkirk
captainkirk

if I understand you right, you mean to say that the CString or LPCSTR you are assigning the text to will not grow?? If that is the case, perhaps you need to reallocate the memory yourself...
Avatar of knewton76

ASKER

It doesn't grow.  How would I reallocate the memory myself?  (I'm a newbie, can you tell?)

Here's how I do the data gathering:

char buffer[MAXBUFFER]

int nread = pFile->Read(buffer, MAXBUFFER);
pFile->Close();

So, the text comes in from a file to a char buffer, then I do something like this:
buffer[nread]='\0';
pDoc->SetEditData(buffer);

in the Document, SetEditData looks like this:

void SetEditData(char*buffer)
{
  m_strText = buffer;
}
ASKER CERTIFIED SOLUTION
Avatar of captainkirk
captainkirk

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