dcsimg


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: Toggling an MDI Child to NonChild

  1. #1
    Robert C. Cain Guest

    Toggling an MDI Child to NonChild

    Howdy,

    I have a form that most of the time will be a child in an MDI form. However,
    in a few circumstances we'd like to reuse that form in a nonMdi way. There's
    two ways I can go with this:

    Method 1: Set the MDIChild property to True at design time.
    Then use SetParent to reset the parent hwnd to 0.

    Problem: The form is freed OK, but the tab key no longer works to navigate
    between controls. (???)

    Method 2:Set the MDIChild property to False at design time.
    Then use SetParent to reset the parent hwnd to the MDIParent's hwnd.

    Problem: The form does not appear maximized, even though we set the window
    state to maximized. Further, it does not show up in the MDI's collection of
    forms.

    I can go either way with this, so if anyone has a suggestion to solve either
    problem, please let me know.

    Thanks,


    Robert



  2. #2
    Mark Alexander Bertenshaw Guest

    Re: Toggling an MDI Child to NonChild


    "Robert C. Cain" <robert.cain@comsys.com> wrote in message
    news:3bd86081@news.devx.com...
    > Howdy,
    >
    > I have a form that most of the time will be a child in an MDI form.

    However,
    > in a few circumstances we'd like to reuse that form in a nonMdi way.

    There's
    > two ways I can go with this:
    >
    > Method 1: Set the MDIChild property to True at design time.
    > Then use SetParent to reset the parent hwnd to 0.
    >
    > Problem: The form is freed OK, but the tab key no longer works to navigate
    > between controls. (???)
    >
    > Method 2:Set the MDIChild property to False at design time.
    > Then use SetParent to reset the parent hwnd to the MDIParent's hwnd.
    >
    > Problem: The form does not appear maximized, even though we set the window
    > state to maximized. Further, it does not show up in the MDI's collection

    of
    > forms.
    >
    > I can go either way with this, so if anyone has a suggestion to solve

    either
    > problem, please let me know.
    >
    > Thanks,
    >
    >
    > Robert
    >
    >


    Robert -

    Don't do either: playing with windows behind VB's back always ends in tears
    of frustration. A more "VB" way to do this is to create a UserControl with
    your form GUI in (just copy and paste everything in the form into the
    UserControl). Then have two forms - one MDI child, and one non-MDI. Place
    the UserControl on both forms. Sweet.

    --
    Mark Alexander Bertenshaw
    Programmer/Analyst
    Chordiant Software, Inc.
    Brentford
    UK



  3. #3
    Mark Alexander Bertenshaw Guest

    Re: Toggling an MDI Child to NonChild


    "Robert C. Cain" <robert.cain@comsys.com> wrote in message
    news:3bd86081@news.devx.com...
    > Howdy,
    >
    > I have a form that most of the time will be a child in an MDI form.

    However,
    > in a few circumstances we'd like to reuse that form in a nonMdi way.

    There's
    > two ways I can go with this:
    >
    > Method 1: Set the MDIChild property to True at design time.
    > Then use SetParent to reset the parent hwnd to 0.
    >
    > Problem: The form is freed OK, but the tab key no longer works to navigate
    > between controls. (???)
    >
    > Method 2:Set the MDIChild property to False at design time.
    > Then use SetParent to reset the parent hwnd to the MDIParent's hwnd.
    >
    > Problem: The form does not appear maximized, even though we set the window
    > state to maximized. Further, it does not show up in the MDI's collection

    of
    > forms.
    >
    > I can go either way with this, so if anyone has a suggestion to solve

    either
    > problem, please let me know.
    >
    > Thanks,
    >
    >
    > Robert
    >
    >


    Robert -

    Don't do either: playing with windows behind VB's back always ends in tears
    of frustration. A more "VB" way to do this is to create a UserControl with
    your form GUI in (just copy and paste everything in the form into the
    UserControl). Then have two forms - one MDI child, and one non-MDI. Place
    the UserControl on both forms. Sweet.

    --
    Mark Alexander Bertenshaw
    Programmer/Analyst
    Chordiant Software, Inc.
    Brentford
    UK



  4. #4
    Dean Earley Guest

    Re: Toggling an MDI Child to NonChild

    "Robert C. Cain" <robert.cain@comsys.com> wrote in message news:3bd86081@news.devx.com...
    > Howdy,
    >
    > I have a form that most of the time will be a child in an MDI form. However,
    > in a few circumstances we'd like to reuse that form in a nonMdi way. There's
    > two ways I can go with this:
    >
    > Method 1: Set the MDIChild property to True at design time.
    > Then use SetParent to reset the parent hwnd to 0.
    >
    > Problem: The form is freed OK, but the tab key no longer works to navigate
    > between controls. (???)
    >
    > Method 2:Set the MDIChild property to False at design time.
    > Then use SetParent to reset the parent hwnd to the MDIParent's hwnd.
    >
    > Problem: The form does not appear maximized, even though we set the window
    > state to maximized. Further, it does not show up in the MDI's collection of
    > forms.
    >
    > I can go either way with this, so if anyone has a suggestion to solve either
    > problem, please let me know.
    >

    If you want to go this route, haven't you set the mdichild properties the wrong way round?
    --
    Dean Earley (dean.earley@icode.co.uk)
    Assistant Developer

    iCode Systems



  5. #5
    Dean Earley Guest

    Re: Toggling an MDI Child to NonChild

    "Robert C. Cain" <robert.cain@comsys.com> wrote in message news:3bd86081@news.devx.com...
    > Howdy,
    >
    > I have a form that most of the time will be a child in an MDI form. However,
    > in a few circumstances we'd like to reuse that form in a nonMdi way. There's
    > two ways I can go with this:
    >
    > Method 1: Set the MDIChild property to True at design time.
    > Then use SetParent to reset the parent hwnd to 0.
    >
    > Problem: The form is freed OK, but the tab key no longer works to navigate
    > between controls. (???)
    >
    > Method 2:Set the MDIChild property to False at design time.
    > Then use SetParent to reset the parent hwnd to the MDIParent's hwnd.
    >
    > Problem: The form does not appear maximized, even though we set the window
    > state to maximized. Further, it does not show up in the MDI's collection of
    > forms.
    >
    > I can go either way with this, so if anyone has a suggestion to solve either
    > problem, please let me know.
    >

    If you want to go this route, haven't you set the mdichild properties the wrong way round?
    --
    Dean Earley (dean.earley@icode.co.uk)
    Assistant Developer

    iCode Systems



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center