CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    May 1999
    Posts
    61

    How can I control Child Window in MDI

    Hi,
    I need your help.
    How can I control every Child Window in MDI.
    I'd like to apply any different constant(number) to every Child Window.
    How can I do that.
    Please help me !!!!!
    Thanke you in advance.

    Drago


  2. #2
    Join Date
    Apr 1999
    Posts
    383

    Re: How can I control Child Window in MDI

    What do you mean by

    > I'd like to apply any different constant(number) to every Child Window.

    Dave


  3. #3
    Join Date
    May 1999
    Posts
    61

    Define more exactly my question

    Hi,
    Thank you for interest to my question.

    I mean that I can't recognize every child window.
    I suppose that I must apply any mark to make recognize every child window.

    Just for example: Opening a new File and add to it differents parameters
    which are special for this document and after that control all views by this parameters. And then use GetFirsDocTemplatePosition() and GetNextDocTemplate() to control all views.
    Waiting you reply.
    Thank you.

    Drago




  4. #4
    Join Date
    Apr 1999
    Posts
    383

    Re: Define more exactly my question

    I'm still not sure what you're trying to do, but if you want to be able to identify views according to the document type they are attached to, access them via the document itself with GetFirstViewPosition/GetNextView.

    If you want to identify individual view instances by some criterion, you'll need to give them a method you can use to query their identity, based on that criterion.

    If you want to identify views by their class type, use run-time type identification, or the new-style dynamic cast.

    Dave


  5. #5
    Join Date
    May 1999
    Posts
    61

    Thank you very much Dave !

    I'd like to thank you for this answer. You describe my problem exactly(to identify individual view instances by some criterion). Now I understood what must I do, but if it's posible please give me more information about this.
    Thank you once again.

    Drago


  6. #6
    Join Date
    Oct 1999
    Location
    Israel
    Posts
    6

    Re: How can I control Child Window in MDI

    Hi! I have the same problem. If you know how to solve it replay me please.
    Thanks



  7. #7
    Join Date
    May 1999
    Posts
    61

    Re: How can I control Child Window in MDI

    Hi Victoria,
    I remembered that my problem was that I could not got a pointer of each MDI Child Window and use it for access to MDI Child's.
    Here what I had done:
    For storing each pointer to MDI Child I use CObList object. And when I open a new Document I put a pointer of this document using AddHead(this). And when I close a document I remove it's poiter from this CObList using:

    POSITION posDoc = pList->Find(this);
    pList->RemoveAt(posDoc);

    Where pList is declare in CMyFrame.h like that:
    CObList* pList;

    For each MDI Child Window you have a Document. And when you have a poiter to this Document you are able to control a View's of MDI Child Windows with:

    POSITION pos = pDoc->GetFirstViewPosition();
    while (pos != NULL)
    {
    CView pView = pDoc->GetNexView(pos)
    }

    This pDoc is pointer to your CDocument derived class. You store it into CObList. And you have a pointer to your class derived from CDocument for each open MDI Child Window.
    I hope that help you.
    Please let me know if this work or not.

    [email protected]

    Regards: Drago


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