Switch GUI application behavior between SDI and MDI
Asked Answered
C

4

14

I currently have an SDI application that is build with Delphi 7, I want the final user to choose the type of interface between SDI and MDI at runtime. my question is how can I change the behavior of the application between SDI and MDI at runtime?

Currently I know a couple of applications build with delphi that allow this: EMS SQL Manager and TOAD.

alt text

thanks in advance.

Catamite answered 29/1, 2010 at 14:30 Comment(0)
E
7

Download the Jedi JVCL and install it and look at the Demos for JvDocking "docking in code". They do this exactly.

They mean that you do not actually use the FormStyle=fsMDIChild unless you want lots of problems. MDI is "emulated" when you need it by docking in code.

Do not convert windows into frames. This is a bad solution.

For an MDI-like environment, that does not have the MDI problems, use a docking solution (components either commercial or open source that support docking). I use JvDocking which is included in the JEDI JVCL, which is free and open source.

You use your forms in both "docked" and "undocked" (floating) modes, and this gives you a docked IDE look and feel (VIsual Studio and RAD Studio), and an undocked IDE Look and feel (RAD Studio in undocked, or classic delphi 7).

Earthquake answered 29/1, 2010 at 21:53 Comment(0)
H
4

I would convert my current windows into frames and put these frames with align=alClient into either mdi child windows or normal windows as configured.

But beware: I have never actually done this, so there might be problems that I don't know about.

Hyp answered 29/1, 2010 at 16:22 Comment(1)
You don't need to convert anything. You can put the FOrms onto your windows without changing them into frames, using TForm.ManualDock.Earthquake
P
2

At runtime set TForm.FormStyle either to fsNormal or fsMDIChild depending on if you want SDI or MDI.

Prophase answered 29/1, 2010 at 17:15 Comment(3)
"real MDI" is bad news. see #1463721Earthquake
@WarrenP: I'm sorry if you do not like MDI, but it is an valid answer to this questionProphase
It's NOTHING to do with NOT LIKING it. It has BAD usability problems. see the link. Today's users have multi-monitor systems, and MDI is just not a good fit any more. Docking allows all the advantages of MDI without it's disadvantages. Not caring about usability doesn't make it "like or not like". It's users I care about. user experience matters. Also, MDI is full of glitches.Earthquake
R
1

Like @WarrenP's solution, I strongly recommend a docking-based solution. It should be said that you don't need to use Jedi VCL to achieve this. As an example, here's a very simple (all-native-vcl) component I've produced which allows you to simply drop on as many instances to your form(s) and set their alignment to enable docking (and tabbed docking) in those regions.

MDI itself is an accident waiting for a place to happen. There are solutions available to achieve the "MDI look and feel" without using MDI itself, though I've yet to encounter one I'd consider "neat" (probably for a lack of looking).

Ultimately you should probably question the wisdom in providing MDI as an option. Docking (with or without the ability to undock, and especially when Tabbed Docking is a user-determined choice) feels more modern, and (done properly) can be far more flexible and intuitive than MDI ever was.

Just my 2-pence worth.

Roble answered 11/4, 2011 at 19:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.