Link to home
Start Free TrialLog in
Avatar of mguedes
mguedes

asked on

Two CEditView questions...

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
Avatar of gurushree
gurushree

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);




Avatar of mguedes

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of jtwine100697
jtwine100697
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mguedes

ASKER

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