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

Thread: MDI Doc/View

  1. #1
    Join Date
    Feb 2005
    Location
    Indiana
    Posts
    261

    MDI Doc/View

    OK I have a MDI application. My app doesn't bring up a MDI Child window at startup but it brings up a modeless dialog. The modeless dialog is created at startup from the CMainFrame class and has a button. When it is clicked I want to open up the MDI child window with view and document. I have never tried this before and is it a matter of getting document and then document template and then calling OpenDocumentFile(NULL);

    I think I could probably get this to work eventually but it's giving me a headache then I wonder if it is right way or not. Thanks in advance.

    jack

  2. #2
    Join Date
    Apr 2009
    Posts
    57

    Re: MDI Doc/View

    Why does it have to be modeless?

  3. #3
    Join Date
    Nov 2007
    Posts
    613

    Re: MDI Doc/View

    Such a technique is used when there are multiple document types. In that case, if you request a new document, first you open a dialog to ask the user about the kind of the document to open, then open it.

    If you look for it, I think you can find somewhere in the MSDN a sample with that. It's done in the way you intend to do it.

  4. #4
    Join Date
    Jun 2006
    Posts
    645

    Re: MDI Doc/View

    Yes. Viewex sample on MSDN does closely what you are trying to do. However, it uses a modal dialog to open the documents.
    Regards,
    Bhushan

  5. #5
    Join Date
    May 2006
    Location
    Dresden, Germany
    Posts
    458

    Re: MDI Doc/View

    I'm wondering too why your inital window has to be a modeless dialog. Should it remain open after clicking the button? If not it can be modal and the solution is easy (as described in the post above).

    With regards
    Programartist

  6. #6
    Join Date
    May 2006
    Location
    Dresden, Germany
    Posts
    458

    Re: MDI Doc/View

    Hello,

    I tried to achieve your original request:

    In the applications InitInstance function I do not show the MDI frame.
    Instead I show a modeless dialog.
    In the modeless dialog I open either doc 1 or doc 2 (via button click(s)).
    The modeless dialog remains open (until it or the app will be closed).
    Each button click will show the (initially not shown) MDI frame.

    I attached a demo project.
    Unfortunalety I had to test it with the ancient VC6, but it should work the same way with the current versions.

    With regards
    Programartist
    Attached Files Attached Files

  7. #7
    Join Date
    Feb 2005
    Location
    Indiana
    Posts
    261

    Re: MDI Doc/View

    The reason it is modeless is because I need to be able to click stuff on the MDI Main frame window. Basically I have a MDI Frame window with a dialog bar and on the dialog bar is a TabCtrl. When you launch the app the Modeless dialog pops up which has numerous controls and a button. You can type in data to search a database. Once you hit the search button I want to hide the Modeless dialog and pop up the CMDIChildWnd and it's document and view. And you can switch through the numerous searches by clicking on the Tab Control. I guess instead of using a Modeless Dialog I could use a CFormview and use a MDI Child Window for that as well.

    Jack

  8. #8
    Join Date
    May 2006
    Location
    Dresden, Germany
    Posts
    458

    Unhappy Re: MDI Doc/View

    Dear left1none,

    Where is the problem to look over my demo? I tried to implement exactly what you want to do. This took me a while and it is not worth any comment by you?

    With regards
    Programartist

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