8

I'm developing a multi-document application. Currently it uses MDI which is quite convenient for me (as a developer) as well as for users I believe. However there is one "against" - I haven't found a solution to quickly load many child windows (each time the window is created and maximized to fill the parent's area, there is an 'animation' of resizing which takes a lot of time) so far, thus I'm considering switching back to tabbed interface (which requires some more work, I need to "embed" a form to the page sheet, as there are many "kinds" of forms available, some for editing text documents, some for other objects)...

So, what is your opinion? Should I use MDI or tabbed interface?

mghie
  • 32,028
  • 6
  • 87
  • 129
migajek
  • 8,524
  • 15
  • 77
  • 116
  • 1
    Related: [Is there still a place for MDI?](http://stackoverflow.com/questions/486020) & [Which's better: MDI children, or modeless dialogs?](http://stackoverflow.com/questions/2451728) – Esteban Küber May 31 '10 at 19:23

4 Answers4

11

To avoid the resizing animation (and thus the delay) of new MDI child windows, send a WM_SETREDRAW message to the parent TForm's ClientHandle property before creating your child windows, and then send it again when you are done, ie:

Self.Perform(WM_SETREDRAW, False, 0);
... create child windows as needed ...
Self.Perform(WM_SETREDRAW, True, 0);
Windows.InvalidateRect(Self.ClientHandle, nil, True);
Windows.UpdateWindow(Self.ClientHandle);
Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
10

MDI was developed back in the Windows 3 days (or possibly earlier?) and isn't well-supported these days. If you need multiple documents with different forms, I'd recommend using a tabbed interface. Use frames instead of forms, and create the new tabs and place a frame on it, aligned alClient.

Mason Wheeler
  • 82,511
  • 50
  • 270
  • 477
  • Sorry but I think you are wrong. MDI was deprecated by Microsoft some years ago. But Microsoft is using it again for example in Office 2007 where you can see a classical MDI system. – Francis Lee Sep 23 '09 at 08:10
  • 6
    No, they're not. Office 2007 uses a proprietary framework, and uses exactly **none** of the built-in WinAPI MDI functionality. It may ++appear++ to be MDI, but it isn't. – Ken White Sep 23 '09 at 18:42
  • 2
    Exactly. Use DOCKING like JvDocking. This "LOOKS LIKE" MDI but is not using the MDI formStyle and the Win31 era code, which, by the way, is buggy. – Warren P Jan 29 '10 at 21:55
  • @KenWhite I didn't believe you in the case of Excel 2007 using a proprietary non-MDI framework, since Excel lets you restore spreadsheets and move them around in their equivalent "MDIClient" window - each spreadsheet has its own title bar, etc. just like standard MDI. But Spy++ shows that it's not a standard MDIClient window, & proof is that the message sniffer did not pick up any MDI Windows messages. Personally I hate it, because it prevents me from moving multiple spreadsheets that are open to different monitors. Word & PowerPoint use standard SDI interfaces and don't have this problem. – James Johnston Oct 11 '13 at 19:21
  • 2
    @JamesJohnston: I investigated it myself when I first heard, because I didn't believe it either, and found the same information with Spy++ or WinSight (don't remember which at the time). I dislike it, too. There are times I want SDI to be able to work with things side by side on multiple monitors, and the way Excel is designed makes it impossible to do so. – Ken White Oct 11 '13 at 21:42
5

There are certainly more negative points to MDI than the one you cite. You can find discussions on this in the Wikipedia, and even in the Windows Interface Guidelines as well. MDI has been deprecated now for years. Microsoft itself isn't using MDI in its "standard" form for any of its big applications any more, they often provide just a MDI emulation together with other UI styles.

If your program is for users with multiple screens both MDI and a tab-based UI have the problem of limiting the document windows to the insides of the parent window.

With a proper application design you don't really have to decide between MDI and tab-based UI. Let your users decide which UI they are most comfortable with, and which fits their working style best. Allow for multiple independent top-level document windows (either in one application instance or in multiple) as well. It can be as easy as creating frame classes for your documents, and deciding at runtime whether to embed them into a tab control, into a MDI child window, or into a top-level window.

mghie
  • 32,028
  • 6
  • 87
  • 129
3

Question: is it important that users be able to see more than one of your embedded forms or frames at a time? If not, certainly go for tabs.

Tabs make it easier to navigate and to see what you have available. But with standard PageControl you can only see one tab at a time - there's no "tiling" or "cascading". Problems begin for example when users need to drag things from one tab to another. It can be done, of course, but is not as convenient - because this time users do not see where they are dragging something to.

To overcome this limitation you'd have to look at a docking UI, which adds complexity, but could give you tabs as well as being able to tile them.

Marek Jedliński
  • 7,088
  • 11
  • 47
  • 57
  • actually there are tabs anyway. They are representing available windows. Each window has it's own tab item, but it's not pagecontrol, just empty tab which - when activated - brings the attached form to front. – migajek Sep 23 '09 at 08:36
  • @migajek I know this is old post, however is funny to see that I made exactly the same thing in a project that I have started on Delphi 1 ! It still working on XE2 the same way: tabs+MDI, however the next release I am killing that concept going to frames. – Eduardo Elias Apr 15 '14 at 20:33