Results 1 to 8 of 8

Thread: Inserting MFC dialogs into MFC dialogs..?

  1. #1

    Thread Starter
    Addicted Member HairyDave's Avatar
    Join Date
    Aug 2002
    Location
    Er...I can't remember.
    Posts
    196

    Inserting MFC dialogs into MFC dialogs..?

    Right, I have an MFC class derived from the CDialog class. I then have loads more of them. Is there a way to insert these other dialogs into the main dialog class?

    If you don't know what I mean, I'm trying to create a GUI that has several stages. I want to place the dialog referring to the current stage into the main dialog so that it can be used.

    For example, take a Wizard type GUI, when you press Next (or whatever) you are taken to the next page. Now, if that next page is a different dialog placed on top of the main dialog, then this would be approximately the same as what I want.

    Hope you understand and can help.

    Thanks

    HD

  2. #2
    Frenzied Member
    Join Date
    Jul 2002
    Posts
    1,370
    Did you try the SetParent() api? It requires the HWND for the proposed parent, proposed child.


    It therefore also changes the message chain - so you need to watch out if you are trapping messages for your main window that you don't mess up messages meant for the child.

  3. #3
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    You mean a chain of dialogs like the VC++6 wizards?
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  4. #4

    Thread Starter
    Addicted Member HairyDave's Avatar
    Join Date
    Aug 2002
    Location
    Er...I can't remember.
    Posts
    196
    Because I don't have many stages to my app, and I know the contents of the dialogs (controls etc), I will probably create dialogs for each stage. I can then load them when required.

    I was asking if I could have a main dialog that would display these dialogs within it. Therefore pressing the Next could increment the counter and load a different dialog into the window.

    HD

  5. #5
    Addicted Member
    Join Date
    Oct 2002
    Posts
    241
    I'm pretty sure that what you want is property pages.

  6. #6
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    No, not quite property pages. Those are a little different.

    What is a controlling dialog good for? Why not have more than one dialog that all are top-level and simply shown one after the other?
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  7. #7

    Thread Starter
    Addicted Member HairyDave's Avatar
    Join Date
    Aug 2002
    Location
    Er...I can't remember.
    Posts
    196
    As I said in my last post - thats probably what I'll do.

    The reason for the control is that I have no idea how many Dialogs I may have. At this moment I do, but the expansion to the app could mean numerous dialogs.

    HD

  8. #8
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Make an array of CDialog pointers (best would be a CTypedPtrArray or CTypedPtrList) and an index that indicates which dialog is current. When the user clicks next you increment the index, when the user clicks previous you decrement it. Do this in a loop until Finish is clicked.

    Then all your dialogs are automatically shown and you only need to play around with creating new instances of various dialog subclasses that you then add to the array.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

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