CEditView, how to display text on open

This is a discussion on CEditView, how to display text on open within the Windows Programming forums, part of the Platform Specific Boards category; I am creating an MDI app. Basically, the app will open binary files, and display the information contained in those ...

  1. #1
    Registered User
    Join Date
    Aug 2008
    Posts
    5

    Post CEditView, how to display text on open

    I am creating an MDI app. Basically, the app will open binary files, and display the information contained in those files as text. The child windows are CEditView windows.

    I want the text to appear in the child windows as I open each file. I have the following code, but I don't know which function to put it in so that text gets displayed automatically after opening a file. Currently, I get the text to display using a mouse button handler.

    Code:
    CString str;
    	
    // set the string here
    
    theCtrl.SetReadOnly();
    theCtrl.ReplaceSel(str);

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,859
    Quote Originally Posted by EmbeddedC View Post
    I have the following code, but I don't know which function to put it in so that text gets displayed automatically after opening a file.
    If I follow the question...

    The event that triggers setting the text is opening the file.
    The end result is the text appearing in front of the user.

    After you have loaded the file,
    converted to text,
    etc,
    set the text in the editview
    and bring the window into view.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  3. #3
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,859
    After thinking about this I think you might want

    WM_INITDIALOG (for dialogs) or WM_CREATE (for windows)

    At this message the window/dialog should be created ready to set the text but not visible.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 10:54 AM
  2. Open Source Text Editors
    By Cxx in forum C++ Programming
    Replies: 2
    Last Post: 01-04-2003, 03:46 AM
  3. Speeding Up Display Time in CEditView :: MFC
    By kuphryn in forum Windows Programming
    Replies: 0
    Last Post: 04-22-2002, 08:24 PM
  4. Accessing a Specific Text Line Inside CEditView :: MFC
    By kuphryn in forum Windows Programming
    Replies: 2
    Last Post: 04-14-2002, 09:12 PM
  5. Replies: 1
    Last Post: 09-01-2001, 11:33 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21