Intializing combo box/control in CFormView
-
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!
-
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!
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 :-)
-
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 :-)
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!
-
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!
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 :-)
-
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 :-)
-
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 :-)
-
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 :-)
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?
-
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!
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