Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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 5-Apr-13 1:45am
Edited 5-Apr-13 3:33am
v6
Comments
nv3 at 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 at 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

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  

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

  Print Answers RSS
0 George Jonsson 215
1 Kornfeld Eliyahu Peter 169
2 Zoltán Zörgő 139
3 PIEBALDconsult 130
4 OriginalGriff 120
0 OriginalGriff 6,165
1 DamithSL 4,658
2 Maciej Los 4,107
3 Kornfeld Eliyahu Peter 3,649
4 Sergey Alexandrovich Kryukov 3,342


Advertise | Privacy | Mobile
Web04 | 2.8.141220.1 | Last Updated 5 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100