Prev: Recommendation needed for embedded scripting solution
Next: Error C2440 cannot convert from void
From: Goran on 19 Jan 2010 05:04 On Jan 19, 2:55 am, Joseph M. Newcomer <newco...(a)flounder.com> wrote: > As pointed out, you want a CFormView. The problem is that generally an SDI app doesn't > really add much over a dialog-based app. MDI is the place to be. That way, you can have > a view which is a CFormView in which you enter data, another view where the OnDraw plots > the data, and you can consider things like doing 3-D where one view is from the top, one > from the front, one from the left, etc. I have found SDI to be approximately useless > nearly all the time, but MDI is extremely powerful, even if you never have more than one > document open (you can even limit it, although that doesn't always make sense). But those > multiple concurrent views are a lot of power. Similarly CSplitterWnd is a very powerful > model, where you can have multiple views with a single document. Hmmm... SDI/MDI a.k.a. Single/Multiple Document Interface distinction of MFC (key words: MFC and document) is about whether the MFC app can open one or more of it's __documents__. There's also system's window manager support for the thing called MDI. But here, name (the "D" part) is kinda poorly chosen: it is more about stacking/tiling child frames inside of a parent frame etc; and indeed, system knows nothing about any documents, it really is about frame __windows__. (Granted, original idea was that each __frame window__ will be used to view one __document__, hence the "D" in the name.) And finally, there's orthogonal SVI/MVI (Single/Multiple View Interface) distinction (which is what you hint at when you say that SDI is useless and that splitter is good). Indeed, SVI is not very interesting. With MVI, though, app has multiple views for a document (e.g. any explorer-style app from AppWizard is that). Interesting variant of that is an __SDI__ application that uses window manager support for MDI to have multiple frame-enclosed views. In short, multiple documents and multiple views distinctions are orthogonal, but AFAIK both are supported by MFC. Goran.
From: Joseph M. Newcomer on 19 Jan 2010 10:57 See below... On Tue, 19 Jan 2010 02:04:47 -0800 (PST), Goran <goran.pusic(a)gmail.com> wrote: >On Jan 19, 2:55�am, Joseph M. Newcomer <newco...(a)flounder.com> wrote: >> As pointed out, you want a CFormView. �The problem is that generally an SDI app doesn't >> really add much over a dialog-based app. �MDI is the place to be. �That way, you can have >> a view which is a CFormView in which you enter data, another view where the OnDraw plots >> the data, and you can consider things like doing 3-D where one view is from the top, one >> from the front, one from the left, etc. �I have found SDI to be approximately useless >> nearly all the time, but MDI is extremely powerful, even if you never have more than one >> document open (you can even limit it, although that doesn't always make sense). �But those >> multiple concurrent views are a lot of power. �Similarly CSplitterWnd is a very powerful >> model, where you can have multiple views with a single document. > >Hmmm... > >SDI/MDI a.k.a. Single/Multiple Document Interface distinction of MFC >(key words: MFC and document) is about whether the MFC app can open >one or more of it's __documents__. **** Yes, but as I point out, you can actually limit this to a single document, but there is little to be gained. The real gain, as you point out below, is the ability to have multiple views. A lot of people confuse "MDI" with "multiple DOCUMENTs" because that's what the name suggests, but the truth is that there are two issues here: multiple documents and multiple views. Both are important, and they got lumped together into a single confusing mish-mash. **** > >There's also system's window manager support for the thing called MDI. >But here, name (the "D" part) is kinda poorly chosen: it is more about >stacking/tiling child frames inside of a parent frame etc; and indeed, >system knows nothing about any documents, it really is about frame >__windows__. (Granted, original idea was that each __frame window__ >will be used to view one __document__, hence the "D" in the name.) > >And finally, there's orthogonal SVI/MVI (Single/Multiple View >Interface) distinction (which is what you hint at when you say that >SDI is useless and that splitter is good). Indeed, SVI is not very >interesting. With MVI, though, app has multiple views for a document >(e.g. any explorer-style app from AppWizard is that). Interesting >variant of that is an __SDI__ application that uses window manager >support for MDI to have multiple frame-enclosed views. **** The "MVI" you refer to does have limitations, such as how the views are handled. Sometimes the full generality of view arrangement that MDI allows is a better choice. As with MDI, the splitter window lumps together the concept of frame and view into a kit bash that isn't quite either. This is why I generally go with MDI. You lose very little by going with MDI, and gain a lot. joe **** > >In short, multiple documents and multiple views distinctions are >orthogonal, but AFAIK both are supported by MFC. > >Goran. Joseph M. Newcomer [MVP] email: newcomer(a)flounder.com Web: http://www.flounder.com MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Tom Serface on 20 Jan 2010 16:14 I see many have responded to your question, but I wanted to just put in that I always build new applications as MDI even if I only plan to have one document and/or one view. It's simple to change the menus and make the child window fill out the whole mainframe and then if you ever want to convert in the future (which you likely will) you can easily add the new functionality. That's the same reason I never use dialog applications. It is just as easy to create a formview based MDI app and build from that. Tom "rockdale" <rockdale.green(a)gmail.com> wrote in message news:9f08bb0a-ec24-4b33-bea4-2a35be301c99(a)a32g2000yqm.googlegroups.com... > Hi, all: > > All my experience on MFC is dialog based application. And now I try to > learn the SDI and MDI based application. I create a sample SDI > application, but then I have no idea what is the next step I need to > do. Like if I want use can enter some data in a CEdit control, how > should I do that. Do I need to create a CDialog and then load it into > the main frame, how to load a CDialog/CView into a main frame, all the > examples on the internet are showing an empty childview, how can I > make the childview doing something? > > Thanks in advance. > -Rockdale
From: Joseph M. Newcomer on 20 Jan 2010 23:10 The only time I have ever built an SDI app is when I teach the MFC course and one of the exercises is an SDI app. I tell my students that SDI apps are exceptionally rare, usually useless, and inevitably the client will decide that what was really wanted was MDI, so the simplest solution is to always start with MDI. joe On Wed, 20 Jan 2010 13:14:03 -0800, "Tom Serface" <tom(a)camaswood.com> wrote: >I see many have responded to your question, but I wanted to just put in that >I always build new applications as MDI even if I only plan to have one >document and/or one view. It's simple to change the menus and make the >child window fill out the whole mainframe and then if you ever want to >convert in the future (which you likely will) you can easily add the new >functionality. > >That's the same reason I never use dialog applications. It is just as easy >to create a formview based MDI app and build from that. > >Tom > >"rockdale" <rockdale.green(a)gmail.com> wrote in message >news:9f08bb0a-ec24-4b33-bea4-2a35be301c99(a)a32g2000yqm.googlegroups.com... >> Hi, all: >> >> All my experience on MFC is dialog based application. And now I try to >> learn the SDI and MDI based application. I create a sample SDI >> application, but then I have no idea what is the next step I need to >> do. Like if I want use can enter some data in a CEdit control, how >> should I do that. Do I need to create a CDialog and then load it into >> the main frame, how to load a CDialog/CView into a main frame, all the >> examples on the internet are showing an empty childview, how can I >> make the childview doing something? >> >> Thanks in advance. >> -Rockdale Joseph M. Newcomer [MVP] email: newcomer(a)flounder.com Web: http://www.flounder.com MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Tom Serface on 21 Jan 2010 02:13
I totally agree. I have several MDI apps that are masquerading as SDI's, but I've had so many times when the requirement changed for the application and users want to open more than one "document" in the same application rather than running multiple instances. Tom "Joseph M. Newcomer" <newcomer(a)flounder.com> wrote in message news:crkfl5101069gp5128r2k23tq72rhdhfp4(a)4ax.com... > The only time I have ever built an SDI app is when I teach the MFC course > and one of the > exercises is an SDI app. I tell my students that SDI apps are > exceptionally rare, usually > useless, and inevitably the client will decide that what was really wanted > was MDI, so the > simplest solution is to always start with MDI. > joe > |