How Can I move MDI child window out of the frame window
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 16

Thread: How Can I move MDI child window out of the frame window

  1. #1
    Join Date
    Sep 2007
    Posts
    59

    How Can I move MDI child window out of the frame window

    I want the child Window created in MDI application to move out the main frame window.
    Main frame is the parent of child frame, so it is always stays inside of the main frame.

    Is it possible by any means, so that I can move child frame out of mainframe.

    Your response will be highly appreciated.

    Thank you,

  2. #2
    ovidiucucu's Avatar
    ovidiucucu is offline Moderator/Reviewer Power Poster
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,123

    Re: How Can I move MDI child window out of the frame window

    No, it's not possible.
    The main property of a child window is: it can lie only in its parent client area.
    Ovidiu Cucu
    "When in Rome, do as Romans do."
    My likes on StumbleUpon
    Visit: Microsoft Virtual Academy
    Follow: https://twitter.com/#!/ovidiucucu
    My blog: http://codexpert.ro/blog/author/ovidiu-cucu/

  3. #3
    Join Date
    Jun 2007
    Posts
    44

    Re: How Can I move MDI child window out of the frame window

    Well you could always create a new window (that looks the same as the old one) that isn't a child of the MDI client window.

  4. #4
    Join Date
    Nov 2006
    Posts
    1,611

    Re: How Can I move MDI child window out of the frame window

    I keep learning that getting away from Windows specific development and moving toward platform independent development has benefits.

    In wxWidgets, I simply reparent the window.

    You can't move the child outside of it's parent - the parent clips the child.

    However, if you change the parent of the window to, say, the desktop, or perhaps another window other than the MDI client window, viola!

    Another approach which I use frequently, is to parent what you're calling the MDI child. That is, The MDI's child window is a parent to the window seen by the user. If I want another receptacle for that window, I reparent it.

    For example, If I want to move an MDI child into a docked window, I make the MDI child the parent of the UI window (you might call it a view window). Then, to switch, I create a window in the docked area that can parent the view, reparent the view and drop the MDI child (which will now be empty).

    I can reparent to a floating host, a second MDI frame on another monitor - sky's the limit.
    If my post was interesting or helpful, perhaps you would consider clicking the 'rate this post' to let me know (middle icon of the group in the upper right of the post).

  5. #5
    Join Date
    Sep 2007
    Posts
    59

    Re: How Can I move MDI child window out of the frame window

    Thanks to all for giving your thought.

    This part will is workign now, but another problem arises.

    ======================
    How can I get rid of the default menu comes with MDI frame. I don't want any menu to attach with the frame window.

    If I don't load the menu (IDR_MAINFRAME), it gives me assertion.

    I can work from context meu.

    Again expecting your ideas.
    Thank you.

  6. #6
    ovidiucucu's Avatar
    ovidiucucu is offline Moderator/Reviewer Power Poster
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,123

    Re: How Can I move MDI child window out of the frame window

    @to JVene
    • However, if you change the parent of the window to, say, the desktop[...]
      Easy to say, a little bit harder to do. Just theory. Have you ever tried that?
    • If I want to move an MDI child into a docked window[...].
      Please note (in the OPs context, "move child frame out of mainframe": The docking area of a MDI main frame is in its client area.

    Of course, at last, can be a solution for every problem, but "moving a MDI child window outside the main frame", at least using MFC framework, is from starting a bad approach.

    @ to s196675m
    It seems, what you want to accomplish (no MDI child windows, no menu,... what's next?...) is opposite to MFCs MDI framework design. No need it? Then, my advice that can prevent a lot of headaches for you is: make a dialog-based application.
    Ovidiu Cucu
    "When in Rome, do as Romans do."
    My likes on StumbleUpon
    Visit: Microsoft Virtual Academy
    Follow: https://twitter.com/#!/ovidiucucu
    My blog: http://codexpert.ro/blog/author/ovidiu-cucu/

  7. #7
    Join Date
    Nov 2006
    Posts
    1,611

    Re: How Can I move MDI child window out of the frame window

    Code:
    Easy to say, a little bit harder to do. Just theory. Have you ever tried that?
    The reason I jumped into this thread is because I use this approach in my own work.

    * Please note (in the OPs context, "move child frame out of mainframe": The docking area of a MDI main frame is in its client area.

    Of course, at last, can be a solution for every problem, but "moving a MDI child window outside the main frame", at least using MFC framework, is from starting a bad approach.
    (My response from here is as much for clarity toward the OP than a reply).

    In my view, the UI metaphor is like a play presented with puppets. We're pulling the strings, attempting to create the illusion of the interface metaphor. If the literal interpretation doesn't fit, that doesn't mean a result that performs, say, a substitution of parent frames which yields the same visible results is somehow invalid simply because it doesn't function, under the hood, the way the original question is formed. Sometimes it's the question that's actually flawed.

    Perhaps my original post wasn’t clear on this point, too (and reading it, I can see it isn’t). The effect of moving the MDI child out of the MDI client frame can be achieved, but it does require a viewpoint (and an application construction method) that gives the option to you.

    The idea assumes the use of a Child/View construction. MDI Children have certain behaviors, not the least of which is to respond to the MDI Frame’s client instructions to behave (cascade, tile, list of windows, etc). That’s a lot more work in win32 than in MFC or wxWidgets, but it also means that literally moving the MDI Child to another parent means that the object representing that window still ‘wants’ to behave like an MDI child.

    The user, however, isn’t thinking in terms of MDI children vs top level windows or docked panels. They’re thinking in terms of the view. They’re thinking of moving a text window, an MDI child dialog, a JPEG image or some other window from the MDI client’s parentage to someplace on the desktop. If the MDI child had all of the details about how to ALSO be that text window, or that JPEG display window, indeed you’d have a problem. The problem is that the behavior of BEING an MDI child is embedded in the C++ object representing the JPEG image, or the text window.

    If the construction treats the view as the central figure, and the MDI child as a host to a generic view, one that can be hosted by a complement of other window types, then the options open up considerably.

    The reparent is performed between the view and its host(s). The Former MDI child host may be destroyed, but the view which the user considered to BE the window they’re moving is not. It’s reparented to a host of the behavioral characteristics of its destination (and as an intermediate UI step, perhaps a generic floater that drags and drops between the MDI source and some other destination). From an application development standpoint, and the user’s viewpoint, all of the view’s material is intact. It hasn’t been destroyed, so its status and its content all remain.

    At this point perhaps we’re thinking in different technologies. I’m thinking of the window as an object, not as an OS instantiation. The OS details surround the UI metaphor design, not the other way around, in this viewpoint.

    You might cry foul on the notion that the MDI child window isn’t what’s been reparented. I concede the point owning to some ambiguity in the way I presented the concept in my post. The reparenting is simple, but the viewpoint of what’s happening is different, yet the user’s experience is exactly as the OP has described.

    Obviously if the window formerly acting as an MDI child leaves the MDI frame area, the default OS concept of MDI has changed. One has to decide if the floater is considered a child. With respect to cascade and tile, it can’t be – the metaphor of MDI has been extended, perhaps a new command that returns all of the floating MDI children back to the original MDI frame is indicated. In other words, since the MDI concept has been extended, the previous behavior of MDI (both host and child) must also be extended to suit. The default cascade and tile, as a simple example, or the menu substitution can no longer continue as before. It’s up to the designer to choose the behavior (the floating host is probably going to adopt a menu from the child, no longer in the style of MDI). The notion of ‘focus’ to a child is altered when a child turns into a docked panel, and so too is the nature of its menu interface.

    An MDI child, if moved as a ‘normal’ window outside the MDI frame’s client area, will be clipped by the MDI frame’s client, and scrollbars will probably be turned on at the same time. The standard means of moving an MDI child (grabbing the title bar) must continue to be honored. This implies a handle in the title bar which the user grabs in order to ‘pick up’ the window (at least that’s how I decided to implement it).

    At that instant, the view is reparented to a UI floater, and the original MDI child may be destroyed (which detaches this view from MDI control, pulling its menu and its name from the list of windows, etc.). The effect, from the user’s viewpoint, is that they’ve picked up the child (they’re thinking of the view’s contents as the window’s identity, not the MDI frame). This floating host is a temporary container that can be used to deposit the window elsewhere, but now when this window exceeds the MDI Frame’s client area, it’s no longer clipped. From the user’s viewpoint, they’ve moved the MDI child outside the MDI’s control.

    It’s true that doing this to a window represented by an object which behaves as an MDI child isn’t so easily reparented, because the underlying C++ object is still going to be an MDI child. One would have to detach the GUI element (the Windows window) from the object, and hand that OS GUI window over to another C++ object representing the new style, and make several adjustments, including a call to ‘SetParent’, and other style switches. While that can be done, it isn’t necessary simply to satisfy the wording of the original question. Nor, in my opinion, would it be viable to make a generic child window object that can switch behavior that matches all contexts such that it can be an MDI child or a top level window, simply to suit the wording of the original question.

    My proposal is the implementation of a design that separates the UI host from the view so you can create the UI metaphor exactly as the question is worded, but without that particular complexity. Perhaps that’s slight of hand, I’ll concede, but one with precedent. Indeed, from the viewpoint of the user and of the application developer, the focus is on the view and where it’s going, the ‘hosts’ simply wrap around it as required. The MDI child becomes a frame host which is only relevant as a decoration and a host to the view’s content and behavior (as is any other host, like a top level, a dockable panel, etc.). While, technically, a new host window is being created and the old one is destroyed, the effective result is the metaphor thought to BE the window being moved (the text, the jpeg, etc) is, simply, being moved.


    If, however, you find that the MDI concept isn't doing what you want (or is doing what you DON'T want), keep in mind that MDI isn't magic. It's really just child windows with certain styles and few standard behaviors, like the menu and the 'window list', the tile and cascade - etc. You can 'do' MDI like things without MDI itself, invoking behavior you prefer. It's especially helpful to think of application development from the UI out, instead of the OS in. When machines had only 16Mbytes of RAM, and speeds were under 90Mhz, we HAD to follow conventions just to get things to fit and work. These days, unless you're squeezing into a handheld (which are also getting increasingly powerful), you're not as bound to convention. Look at the tabbed 'MDI' like interface of Visual Studio. That's not 'standard MDI' behavior, but click on an option setting, and it can be.
    Last edited by JVene; October 20th, 2007 at 12:47 PM.
    If my post was interesting or helpful, perhaps you would consider clicking the 'rate this post' to let me know (middle icon of the group in the upper right of the post).

  8. #8
    Join Date
    Jun 2007
    Posts
    44

    Re: How Can I move MDI child window out of the frame window

    And really, there are many good reasons why the MDI concept isn't being used much anymore, even by Microsoft. It has too many limits and irritations, and isn't the most intuitive thing for the user. I've moved away from it myself.

  9. #9
    Join Date
    Nov 2006
    Posts
    1,611

    Re: How Can I move MDI child window out of the frame window

    I was thinking the same thing, too. I like the tabbed interface concept Visual Studio 'replaced' MDI with there. I found that making a UI specifically to take advantage of multiple monitors 'feels' right in usability tests; multiple tabbed hosts (the replacement for MDI) - one for each display, with perhaps a third display devoted to the splitter/docked control pads, depending on UI requirements.
    If my post was interesting or helpful, perhaps you would consider clicking the 'rate this post' to let me know (middle icon of the group in the upper right of the post).

  10. #10
    ovidiucucu's Avatar
    ovidiucucu is offline Moderator/Reviewer Power Poster
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,123

    Re: How Can I move MDI child window out of the frame window

    Quote Originally Posted by JVene
    In my view, the UI metaphor is like a play [ ...blah-blah... ]
    I would like to suggest you to write a book or at least an article with your vision about the UI metaphor.
    Last edited by ovidiucucu; October 21st, 2007 at 03:39 PM.
    Ovidiu Cucu
    "When in Rome, do as Romans do."
    My likes on StumbleUpon
    Visit: Microsoft Virtual Academy
    Follow: https://twitter.com/#!/ovidiucucu
    My blog: http://codexpert.ro/blog/author/ovidiu-cucu/

  11. #11
    Join Date
    Apr 2015
    Posts
    3

    Post Re: How Can I move MDI child window out of the frame window

    Quote Originally Posted by s196675m View Post
    Thanks to all for giving your thought.

    This part will is workign now, but another problem arises.

    ======================
    How can I get rid of the default menu comes with MDI frame. I don't want any menu to attach with the frame window.

    If I don't load the menu (IDR_MAINFRAME), it gives me assertion.

    I can work from context meu.

    Again expecting your ideas.
    Thank you.

    How Can I move MDI child window out of the frame window. how it is possible please help me dude...iam also faced that problem.. its very urgent plss help me..send that example my mail i.d- pavan1146@gmail.com thanks in advance

  12. #12
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,208

    Re: How Can I move MDI child window out of the frame window

    Quote Originally Posted by pavan booma View Post
    its very urgent try to understand.........
    I wonder how many times it to take to understand that it doesn't work this way.

    CreateMDIWindow function
    WM_MDICREATE message

    Remarks

    The MDI child window is created with the window style bits WS_CHILD, WS_CLIPSIBLINGS, WS_CLIPCHILDREN, WS_SYSMENU, WS_CAPTION, WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX, plus additional style bits specified in the MDICREATESTRUCT structure. The system adds the title of the new child window to the window menu of the frame window. An application should use this message to create all child windows of the client window.
    Any window having WS_CHILD style is limited by its parent client area.

    PS. So basically "move MDI child window out of the frame window" sounds like a nonsense.
    Best regards,
    Igor

  13. #13
    Join Date
    Apr 2015
    Posts
    3

    Post Re: How Can I move MDI child window out of the frame window

    Quote Originally Posted by Igor Vartanov View Post
    I wonder how many times it to take to understand that it doesn't work this way.

    CreateMDIWindow function
    WM_MDICREATE message



    Any window having WS_CHILD style is limited by its parent client area.

    PS. So basically "move MDI child window out of the frame window" sounds like a nonsense.



    please tell me guys try to understand my situation its very urgent in this task...anybody is there thnks in advance


    How Can I move MDI child window out of the frame window

    its is possible or not say yes or no....

  14. #14
    Join Date
    Apr 2015
    Posts
    3

    Re: How Can I move MDI child window out of the frame window

    please tell me guys try to understand my situation its very urgent in this task...anybody is there thnks in advance


    How Can I move MDI child window out of the frame window

    its is possible or not say yes or no....

  15. #15
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,934

    Re: How Can I move MDI child window out of the frame window

    Quote Originally Posted by pavan booma View Post
    please tell me guys try to understand my situation its very urgent in this task...anybody is there thnks in advance


    How Can I move MDI child window out of the frame window

    its is possible or not say yes or no....
    The answer is simple and you got it already: no!
    However, if you described more clear what your real problem is then we would try to help you in finding some "workaround".

    PS: please, don't post the same question again and again. It does not help, only disturb!
    Besides, it would cause to ban you in the forum for some time.
    Victor Nijegorodov

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center