CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Oct 2007
    Posts
    96

    CEditView or CRichEditView Class

    Hello All.

    I need some advice about using one or the other of the above mentioned classes. What I need is to display messages inside of a CEditView object of the users session with a FTPClient application that I am writing. So essentially I want to keep track of the users interaction with the program.

    However what I needed to know is it possible to use the CEditView or CRichEditView class to make the window background all white and not shaded which right now its a taint of grey/beige (using CEditview) in my case.

    So which of these two classes will accomplish with what I am asking or is it one of the two will do the trick.

    Thanks in advance.

  2. #2
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: CEditView or CRichEditView Class

    EditView should be wite unless you set it to read only I believe.

  3. #3
    Join Date
    Oct 2007
    Posts
    96

    Re: CEditView or CRichEditView Class

    Thanks for the reply. I have decided to go with CEditView but was wondering if anyone knows how to disable the confirmation of Saving the changed/modified document once I have added items to the View ? Another words when I close out the application I get a "Save changes to Untitled ?" I imagine that it has something to adding text lines to the CEditView. I have also chosen for the document to be ReadOnly.

    Any suggestions would be kindly appreciated.

  4. #4
    Join Date
    Oct 2007
    Posts
    96

    Re: CEditView or CRichEditView Class

    I did find a solution via google.com from someone else who was having the exact same issue. However it still does not work for me. In that I get prompted to save the document.

    Here is the code I found here and the results of the implementation

    http://www.eggheadcafe.com/software/...x-in-cedi.aspx

    Code:
    void CMainFrame::OnClose() 
    {
        CEdit * editCtrl = (CEdit*)CWnd::FromHandle(m_hndLogView); 
        if(editCtrl->GetModify())                                // returns TRUE
            editCtrl->SetModify(FALSE);
    
        BOOL val = editCtrl->GetModify();                 // returns FALSE
        CFrameWnd::OnClose();}
    Last edited by justmehere; June 10th, 2009 at 12:50 PM.

  5. #5
    Join Date
    Oct 2007
    Posts
    96

    Re: CEditView or CRichEditView Class

    I thought I would post the solution that does work. I was able to find the solution on another developer forum. Here is the working solution.

    Code:
    void CMainFrame::OnClose() 
    { 
            // TODO: Add your message handler code here and/or call default 
            if(GetActiveFrame()) 
            { 
                    CView* pView = GetActiveFrame()->GetActiveView(); 
                    if(pView) 
                    { 
                            CDocument* pDoc = pView->GetDocument(); 
                            if(pDoc) 
                                    pDoc->SetModifiedFlag(FALSE); 
                    } 
            } 
            CMDIFrameWnd::OnClose();

    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured