Click here to Skip to main content
15,890,946 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello people all welcome. I hav started my career in windows programming.
I am doing an project in SDI. I have two functions name sendtext(CString str) and
displaytext(CString inr) both in different class.
I have a pointer name pView to send the string str to function "displaytext".
The problem is after some operations i get a text in str and i send that text to display text in the output screen i get the text and wen the second text comes to "displaytext" the former text disappears and the latest string only present. Pleae help me like how can i display both the text in the output window on ClistCtrl class.

Void sendtext(CString str)
{
   // do some operations
................
  pView->displaytext(str);
}

void displaytext(CString inr)
{
  CListCtrl &ctlsde = this->GetListCtrl();
  ctlsde.InsertColumn(1,  _T("First "),   LVCFMT_LEFT,   80);

  int nItem;
	nItem = ctlsde.InsertItem(0,  inr);
}
Posted
Updated 5-Apr-13 2:33am
v6
Comments
nv3 5-Apr-13 7:07am    
I don't believe that this the code is that you are executing. It wouldn't even compile (Cstring instead of CString). And do you really want to insert an additional column each time you displaytext is called?
rexamkaruaz 5-Apr-13 8:27am    
I know it is CString and not Cstring i dint do ctrl+c or ctrl+v the code i jus typed here.Nope i dont want an additional column to be inserted rather it must be like following entey.
if first display text is "Good" and second is "Bad"
i want it to be displayed like
First(Column name)
Bad
Good

1 solution

It is probably the InsertColumn call that is spoiling your game. At the second call of displaytext you insert a new column, thereby shifting the existing column to the right and out of view. That is why you don't see the first value any longer.

Place that InsertColumn call in your dialog OnInitialUpdate code. Then it should work.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900