0

I have a dialog based MFC application. Now I want to create a wiew (one or more) with a toolbar, scroll bars and a client window (based on CWnd).

What MFC class should I base this window on? What is the best way to do it?

Thanks.

2 Answers2

0

Using a scrolling client window is more natural in a Document-View application than a dialog based application -- you can have menu bars and toolbars connected to a dialog, but to a View as far as I know.

A SDI application allows support for multiple docking/floating toolbars and multiple views of the same document, so this would be my advice...

Edward Clements
  • 5,040
  • 2
  • 21
  • 27
0

Start with a CFrameWnd. It's job is to give your window a titlebar/close button etc., and position control bars (such as a toolbar) and a menu (if you want one) and a view within itself. The view should be a CScrollView (for painted graphics) or a CFormView (for dialog-like controls).

You will find this to be a lot easier if your just start from scratch and let the app wizard generate an SDI or MDI app to start with.

ScottMcP-MVP
  • 10,337
  • 2
  • 15
  • 15
  • The problem with CFrameWnd is that the constructor/destructor is 'protected' so I cannot create it (there's a comment in the header saying "protected constructor used by dynamic creation"). All the examples I can find uses a CFrameWnd(Ex) as the main application window either in a SDI or MDI application. I want a free floating window, not a window shown inside the SDI/MDI frame. – Ole Bjørn Setnes Aug 16 '13 at 08:19
  • It is the derived class of CFrameWnd created with the Class Wizard that has the protected constructor/destructor. The base class hasn't. I Wonder why. – Ole Bjørn Setnes Aug 16 '13 at 08:39