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. Intializing combo box/control in CFormView

Intializing combo box/control in CFormView

Scheduled Pinned Locked Moved C / C++ / MFC
architecturequestion
9 Posts 4 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.
  • A Offline
    A Offline
    aldeba
    wrote on last edited by
    #1

    Where do i initialize the combo box/control in a CFormView when i'm using a Doc/View architecture? I would need to set some default values in the combo box or other controls. Thanxs!

    M N 2 Replies Last reply
    0
    • A aldeba

      Where do i initialize the combo box/control in a CFormView when i'm using a Doc/View architecture? I would need to set some default values in the combo box or other controls. Thanxs!

      M Offline
      M Offline
      Mazdak
      wrote on last edited by
      #2

      After you define controller for it I think constructor is the correct place for it. Mazy "The more I search, the more my need For you, The more I bless, the more I bleed For you."The Outlaw Torn-Metallica

      1 Reply Last reply
      0
      • A aldeba

        Where do i initialize the combo box/control in a CFormView when i'm using a Doc/View architecture? I would need to set some default values in the combo box or other controls. Thanxs!

        N Offline
        N Offline
        Nish Nishant
        wrote on last edited by
        #3

        aldeba wrote: Where do i initialize the combo box/control in a CFormView when i'm using a Doc/View architecture? OnInitialUpdate Nish


        Author of the romantic comedy Summer Love and Some more Cricket [New Win] Buy it, read it and admire me :-)

        A 1 Reply Last reply
        0
        • N Nish Nishant

          aldeba wrote: Where do i initialize the combo box/control in a CFormView when i'm using a Doc/View architecture? OnInitialUpdate Nish


          Author of the romantic comedy Summer Love and Some more Cricket [New Win] Buy it, read it and admire me :-)

          A Offline
          A Offline
          aldeba
          wrote on last edited by
          #4

          I'm not sure why, but OnInitialUpdate is not being called. Set a breakpoint there, but there was no break. My program works such that, when i click on a button the view will change. Thus OnInitialUpdate should be called rite? The problem is that i used the resource editor to create the FormView and placed all the controls there. And i'm unable to initalize it. Is it possible that i would need to use m_myComboBox.Create(......); and not be dependent on MFC to initalize the window that the combo box belong to? Thanxs!

          N A 2 Replies Last reply
          0
          • A aldeba

            I'm not sure why, but OnInitialUpdate is not being called. Set a breakpoint there, but there was no break. My program works such that, when i click on a button the view will change. Thus OnInitialUpdate should be called rite? The problem is that i used the resource editor to create the FormView and placed all the controls there. And i'm unable to initalize it. Is it possible that i would need to use m_myComboBox.Create(......); and not be dependent on MFC to initalize the window that the combo box belong to? Thanxs!

            N Offline
            N Offline
            Nish Nishant
            wrote on last edited by
            #5

            aldeba wrote: My program works such that, when i click on a button the view will change. Thus OnInitialUpdate should be called rite? In that case put it inside OnUpdate() Nish


            Author of the romantic comedy Summer Love and Some more Cricket [New Win] Buy it, read it and admire me :-)

            A 1 Reply Last reply
            0
            • A aldeba

              Nope, no response for breakpoint in OnUpdate().. :(

              N Offline
              N Offline
              Nish Nishant
              wrote on last edited by
              #6

              aldeba wrote: Nope, no response for breakpoint in OnUpdate().. When you switch views, call UpdateAllViews() Nish


              Author of the romantic comedy Summer Love and Some more Cricket [New Win] Buy it, read it and admire me :-)

              A 1 Reply Last reply
              0
              • N Nish Nishant

                aldeba wrote: My program works such that, when i click on a button the view will change. Thus OnInitialUpdate should be called rite? In that case put it inside OnUpdate() Nish


                Author of the romantic comedy Summer Love and Some more Cricket [New Win] Buy it, read it and admire me :-)

                A Offline
                A Offline
                aldeba
                wrote on last edited by
                #7

                Nope, no response for breakpoint in OnUpdate().. :(

                N 1 Reply Last reply
                0
                • N Nish Nishant

                  aldeba wrote: Nope, no response for breakpoint in OnUpdate().. When you switch views, call UpdateAllViews() Nish


                  Author of the romantic comedy Summer Love and Some more Cricket [New Win] Buy it, read it and admire me :-)

                  A Offline
                  A Offline
                  aldeba
                  wrote on last edited by
                  #8

                  Thanxs that did work. But still the controls in the FormView still have invalid handle to the window, it seems that the controls were not properly intialized to the correct window when it was replaced. i used the code from UsefulSplitterWnd,ReplaceView() CCreateContext context; BOOL bSetActive; if ((GetPane(row,col)->IsKindOf(pViewClass))==TRUE) return FALSE; // Get pointer to CDocument object so that it can be used in the creation // process of the new view CDocument * pDoc= ((CView *)GetPane(row,col))->GetDocument(); CView * pActiveView=GetParentFrame()->GetActiveView(); if (pActiveView==NULL || pActiveView==GetPane(row,col)) bSetActive=TRUE; else bSetActive=FALSE; // set flag so that document will not be deleted when view is destroyed pDoc->m_bAutoDelete=FALSE; // Delete existing view ((CView *) GetPane(row,col))->DestroyWindow(); // set flag back to default pDoc->m_bAutoDelete=TRUE; // Create new view context.m_pNewViewClass=pViewClass; context.m_pCurrentDoc=pDoc; context.m_pNewDocTemplate=NULL; context.m_pLastView=NULL; context.m_pCurrentFrame=NULL; CreateView(row,col,pViewClass,size, &context); CView * pNewView= (CView *)GetPane(row,col); if (bSetActive==TRUE) GetParentFrame()->SetActiveView(pNewView); RecalcLayout(); GetPane(row,col)->SendMessage(WM_PAINT); return TRUE; Anyone?

                  1 Reply Last reply
                  0
                  • A aldeba

                    I'm not sure why, but OnInitialUpdate is not being called. Set a breakpoint there, but there was no break. My program works such that, when i click on a button the view will change. Thus OnInitialUpdate should be called rite? The problem is that i used the resource editor to create the FormView and placed all the controls there. And i'm unable to initalize it. Is it possible that i would need to use m_myComboBox.Create(......); and not be dependent on MFC to initalize the window that the combo box belong to? Thanxs!

                    A Offline
                    A Offline
                    Alexandru Savescu
                    wrote on last edited by
                    #9

                    Maybe there is something wrong with your debugger :( I know that OnInitialUpdate for CFormView is an equivalent from OnInitDialog in CDialog, so you should be able to break in the code. Best regards, Alexandru Savescu

                    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