?
Solved

CString variable for multiline edit box not big enough?

Posted on 2005-03-08
9
Medium Priority
?
344 Views
Last Modified: 2013-11-20
I have a dialog with a multiline edit box that pops up when a button is clicked on another dialog. Information on the original dialog is to be displayed in the multiline edit box of this new popped up dialog. I gave the edit box a variable of type Cstring, and appended all the information to this Cstring, then in the end, write this Cstring out to the multiline edit box, but it seems it can hold up to 3 lines only...when I have more stuff appended teh old lines get overwritten...does this mean Cstring is limited to a certain number of characters? and how can I make it so that it'll let me append more lines to it to be displayed in teh edit box?
0
Comment
Question by:jade03
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 30

Expert Comment

by:Axter
ID: 13489341
Hi jade03,
> >does this mean Cstring is limited to a certain number of characters?
It would take a lot more then 3 lines to reach the CString limit.

Can you post your code?
Can you show how you're appending the information?

What type of data do you have in the CString?  

Does it include binary none-printable characters?

David Maisonave :-)
Cheers!
0
 
LVL 30

Expert Comment

by:Axter
ID: 13489365
jade03,
FYI:
A CString object can store up to INT_MAX (2,147,483,647) characters.
See following link:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/HTML/_core_strings_in_mfc.asp

David Maisonave  :-}
0
 

Author Comment

by:jade03
ID: 13489467
here's what I have (note, CShowInfo is a class created so that I could manipulate the look and feel of the edit box (ie changing it's bg color, text color etc), and the variable in that class, m_allInfo is a CString):

CShowInfo info;
CString finalStr;

      // string together all fields
      finalStr = "Debug:\t\tDebug Level [0-9], amount of output olsrd sends to stdout.\r\n";
      finalStr = finalStr + "IPVersion:\tIP Version olsrd is used. Default = 4\r\n";
      finalStr = finalStr + "Hna4:\t\tAnnounce connectivity to external networks using HNA messages (internet connectivity, set 0.0.0.0.0.0.0.0)\r\n";
      finalStr = "Interface:\tNetwork interface on which olsrd should run.\r\n";
      finalStr = finalStr + "AllowNoInt:\tKeeps running if no network interfaces are available? Defaults to yes\r\n";
      finalStr = finalStr + "Loadplugin:\tPlugin that olsrd is to load at startup. Must be absolute path, or loader will, ";
      finalStr = finalStr + "1) try paths in LD_LIBRARY_PATH, 2) List libraries cached in /etc/ld.so.cache, 3) /lib, followed by /usr/lib\r\n";
      finalStr = "IP4Broad:\tForces the given IPv4 broadcast address to be used as destination address for all outgoing OLSR traffic. 'auto' uses address every card is configured with.\r\n";
      finalStr = finalStr + "IP6AddrType:\tIPv6 address scope; Must be 'site-local' or 'global'.\r\n";
      finalStr = finalStr + "IP6Multi-Site:\tIPv6 multicast address to use when using site-local addresses. 'auto' uses default ff05::15.\r\n";
      


      info.m_allInfo = finalStr;

        // call child dialog to popup
      info.DoModal();
0
Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

 

Author Comment

by:jade03
ID: 13489488
currently only the last 3 lines show up in my edit box when teh new dialog pops up
0
 
LVL 30

Accepted Solution

by:
Axter earned 100 total points
ID: 13489646
finalStr = "Interface:\tNetwork interface on which olsrd should run.\r\n";

The above line is overwriting everything added to the string in the previous three lines
0
 
LVL 30

Expert Comment

by:Axter
ID: 13489652
finalStr = "IP4Broad:\tForces the given IPv4 broadcast address to be used as destination address for all outgoing OLSR traffic. 'auto' uses address every card is configured with.\r\n";

The above line is also overwriting everything added in the previous lines.
0
 

Author Comment

by:jade03
ID: 13489675
oh my gosh! can't believe I overlooked the missing "finalStr + " thing on that line! Axter, thank you sooo much for catching that....it works now... :)
0
 
LVL 30

Expert Comment

by:Axter
ID: 13489695
>>oh my gosh! can't believe I overlooked the missing "finalStr + " thing on that line! Axter, thank you sooo much for catching that....it works now... :)

Sometimes you just need a second pair of eyes to look at it.
0
 

Author Comment

by:jade03
ID: 13489872
yes, so much for my trying to save myself some typing by doing cutting and pasting....

your tip has saved me from going crazy and pulling my hair out over it...cuz I kept staring at it and couldn't find anything wrong w/ it...

u guys are great!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question