Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Using CFormView in SDI app

Using CFormView in SDI app

Scheduled Pinned Locked Moved C / C++ / MFC
data-structuresquestionannouncement
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    RoyceF
    wrote on last edited by
    #1

    Hi, I have a CFormView-based SDI project in which I need to programmatically create & update an array of buttons in a view window. It seems that a CFormView would be the best class to use for this window, but I can't seem to create the window. What type of parent should the window have? I need to create it in the app's main CFormView window. Can that be done? Can anyone point me to a sample project? Thanks, Royce

    J 1 Reply Last reply
    0
    • R RoyceF

      Hi, I have a CFormView-based SDI project in which I need to programmatically create & update an array of buttons in a view window. It seems that a CFormView would be the best class to use for this window, but I can't seem to create the window. What type of parent should the window have? I need to create it in the app's main CFormView window. Can that be done? Can anyone point me to a sample project? Thanks, Royce

      J Offline
      J Offline
      Jorgen Sigvardsson
      wrote on last edited by
      #2

      A CFormView is basically a modeless dialog. It's nothing special really. What window fails to create? The buttons, or the CFormView? -- Pictures[^] from my Japan trip.

      R 1 Reply Last reply
      0
      • J Jorgen Sigvardsson

        A CFormView is basically a modeless dialog. It's nothing special really. What window fails to create? The buttons, or the CFormView? -- Pictures[^] from my Japan trip.

        R Offline
        R Offline
        RoyceF
        wrote on last edited by
        #3

        The CFromView fails to create a window when the class ctor is called.

        J 1 Reply Last reply
        0
        • R RoyceF

          The CFromView fails to create a window when the class ctor is called.

          J Offline
          J Offline
          Jorgen Sigvardsson
          wrote on last edited by
          #4

          You cannot create child controls in the constructor, because the window is not created yet. You see, the CFormView object is nothing but a wrapper around a HWND (window handle). You will have much better luck if you create the child controls in OnInitialUpdate() (that is a virtual method which you can override, and is found in the classwizard). All MFC window/control* classes are only wrappers around window handles, they are not windows themselves. They merely present a C++-friendly interface (some may disagree with this) to the messaging protocols which the window supports. -- Pictures[^] from my Japan trip. -- modified at 8:56 Sunday 4th December, 2005

          G 1 Reply Last reply
          0
          • J Jorgen Sigvardsson

            You cannot create child controls in the constructor, because the window is not created yet. You see, the CFormView object is nothing but a wrapper around a HWND (window handle). You will have much better luck if you create the child controls in OnInitialUpdate() (that is a virtual method which you can override, and is found in the classwizard). All MFC window/control* classes are only wrappers around window handles, they are not windows themselves. They merely present a C++-friendly interface (some may disagree with this) to the messaging protocols which the window supports. -- Pictures[^] from my Japan trip. -- modified at 8:56 Sunday 4th December, 2005

            G Offline
            G Offline
            Gary R Wheeler
            wrote on last edited by
            #5

            Jörgen Sigvardsson wrote:

            They merely present a C++-friendly interface (some may disagree with this)

            Aw, don't spoil his fun, Jörgen :-D.


            Software Zen: delete this;

            R 1 Reply Last reply
            0
            • G Gary R Wheeler

              Jörgen Sigvardsson wrote:

              They merely present a C++-friendly interface (some may disagree with this)

              Aw, don't spoil his fun, Jörgen :-D.


              Software Zen: delete this;

              R Offline
              R Offline
              RoyceF
              wrote on last edited by
              #6

              Yes, I understand all that. It is the creation of the CFormview window that I am having trouble with. How and when do I create it? Must it be a child of a CFrameWnd? Can it be a child of another CFormView?

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups