?
Solved

Two CEditView questions...

Posted on 1998-01-13
4
Medium Priority
?
387 Views
Last Modified: 2013-11-20
First question:
How can i display text lines(like in devstudio debug window) in a CEditView derived window quickly and simply? code avaliable?
Second question:
How can i make a full line selection function with the SetSel member function(How can i find the starting and ending char)

Thanx in advance.
Mário Guedes
0
Comment
Question by:mguedes
[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
  • 2
4 Comments
 

Expert Comment

by:gurushree
ID: 1313957
First Question:

I guess u want to display something like a file in the EditView.
{
    CStdioFile file;
  BOOL bOpenOK = file.Open( sFileName,
                    CFile::modeRead );
if (FALSE == bOpenOK)
{
            .....
            return ;
};
fileOut.ReadString( sLine );
while(fileOut.ReadString( sLine ))
{
source += sLine + "\r\n";
}
fileOut.Close();
}

In InitialUpdate of EditView, do the following,
{
 GetEditCtrl().SetWindowText(source);
}


Second Question:
 i am assuming that u know the line no., if not get the line number using,
int nLine_no = GetEditCtrl().LineFromChar(-1) // i.e get the line no, for the                                                                                                                                                                                // current cursor  position

int nStartIndex = GetEditCtrl().LineIndex(nLine_no);
int nCnt = GetEditCtrl().GetLine(nLine_no, (LPCTSTR)buffer);
// Now select the whole line
GetEditCtrl().SetSel(nStartIndex, nStartIndex + (strlen) buffer);




0
 

Author Comment

by:mguedes
ID: 1313958
I'm very sorry if you don´t understand my first question.I want display text lines while i´m execute some operation(like in devstudio debug window). Do you no if there is anyway to "send" one line of text to my CEditview window.
Thanx anyway for your response to my second question.
0
 
LVL 4

Accepted Solution

by:
jtwine100697 earned 30 total points
ID: 1313959
  If I understand the first part right, you are trying to make a status display, and just add lines to it as some operation progresses, all you need to to is do a CEditCtrl::SetSel(...) to place the caret at the end of the text, and then a CEditCtrl::ReplaceSel(...) with the text you want to add (use CEditView::GetEditCtrl() to gain a reference to the CEditView's Edit Control).

For Example:

   int         iTextLen = 0;
   CEditCtrl   &ecEdit = CEditView::GetEditCtrl();

   iTextLen = ecEdit.GetWindowTextLength();
   ecEdit.SetSel( iTextLen, iTextLen );
   ecEdit.ReplaceSel( "This Text Will Be Added\r\n" );

-=- James.

0
 

Author Comment

by:mguedes
ID: 1313960
Thank´s you for help me James. If you are any problem that i can help´s mail me.

Mário Guedes

mguedes@utad.pt
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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 …

771 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