Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Need to show whole text file in a edit box.

Posted on 1998-08-02
6
Medium Priority
?
237 Views
Last Modified: 2013-11-19
I have code below which loads a text file into an edit box on a dialog window.  Only it only show the first 100 or so characters.  I have scroll boxes etx, but how can I get it to show the whole text file in any length.  That way I can scroll down the text file in the edit box in the dialog window.  Am I using the wrong kind of variable.  It's set as a value and then CString.  I use ClassWizrad.

Please speak in laymens terms, I'm a newbie and will get lost easy if you use crazy words.

Here's my code.

void CNumbersDlg::OnLoadNumbers()
{
      // TODO: Add your control notification handler code
        // here

      //Will Load the Numbers.TXT File

      CFile f;
      if ( f.Open("E:\\Numbers.txt", CFile::modeRead)== FALSE )
            return;

      //Creare an archive odject
      CArchive ar( &f, CArchive::load );

      //Serialzie data from the archive into m_NumbersEdit
      ar >> m_NumbersEdit;

      //Close the archive
      ar.Close();

      //Close the file.
      f.Close();

      //Update screen with the Numbers information
      UpdateData(FALSE);
}
0
Comment
Question by:fredmastro
[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
  • 3
  • 2
6 Comments
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1320126
Have you set the dialog box to be multi-lined?  And is the variable m_NumbersEdit a CString?
0
 
LVL 2

Author Comment

by:fredmastro
ID: 1320127
The Dialog box is multi-lined and the the variable is CSting. (I mentioned that in the original question).
0
 

Accepted Solution

by:
slicer earned 100 total points
ID: 1320128
There are two ways of doing this.......

for both the method add variable for  the edit box--> as control  
a) Using Messages

1) See whether the string you r loading have linefeed or not... linefeed as ascii value 10
2) if not u have to send WM_KEYDOWN message to edit box after each line end encountered in cstring.
3)and then use setwindowtext.

b) using Drawtext....
1) Get the Dc of edit box.
2) calculate the text height..... using GettextMetrics
3)use Drawtext for eachine and specify correct rectangle... (u have to use loop)
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Expert Comment

by:slicer
ID: 1320129
Second method is tested one....
0
 
LVL 2

Author Comment

by:fredmastro
ID: 1320130
Too complicated for a newbie like me.
0
 
LVL 2

Author Comment

by:fredmastro
ID: 1320131
Too complicated for me.  I did other researhing and found that you can't add all those characters to an edit box unless I change it's buffer somehow.  I have to use a richedit box.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
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.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

610 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