Bonjour,
Sous Visual C++, j'ai crée une application avec une vue principale (dérivée de CRecordView), laquelle contient un controle CTabCtrl, avec 2 onglets.
J'ai egalement 2 vues supplémentaires (dérivées de CFormView), lesquelle correspondent a mes onglets.
Ma 2e vue contient un controle CFlexGrid.
Mes onglets fonctionnent parfaitement, mais mon controle FlexGrid ne s'affiche pas (alors que tous les autres controles sont visible).
Voici quelques morceaux de mon code source:
void CLucilleView::OnInitialUpdate()
{
// CLucilleView Vue Principale, dérivée de CRecordView
// m_TabCtrl Mon controle CTabCtrl, crée a partir de Class Wizard
// CView* m_PatientTab
// CView* m_ConsultationTab
// CPatientTabView 1ere vue de mon onglet, dérivée de CFormView
// CConsultationTabView 2ieme vue de mon onglet, derivée de CFormView
|
|
|
m_TabCtrl.InsertItem(0, _T("Etat Civile"));
m_TabCtrl.InsertItem(1, _T("Dossier"));
m_TabCtrl.GetWindowRect(&CtrlRect);
ScreenToClient(&CtrlRect);
m_PatientTab = new CPatientTabView;
m_PatientTab->Create(NULL, NULL, 0L, CtrlRect, this, IDD_PATIENT_TAB);
m_PatientTab->GetWindowRect(&TabRect);
ScreenToClient(&TabRect);
m_PatientTab->SetWindowPos(NULL,CtrlRect.left+5,CtrlRect.top+25,TabRect.Width(),TabRect.Height(), SWP_NOZORDER);
m_PatientTab->ShowWindow(SW_SHOW);
m_ConsultationTab = new CConsultationTabView;
m_ConsultationTab->Create(NULL, NULL, 0L, CtrlRect, this, IDD_CONSULTATION_TAB);
m_ConsultationTab->SetWindowPos(NULL,CtrlRect.left+5,CtrlRect.top+25,TabRect.Width(),TabRect.Height(), SWP_NOZORDER);
m_ConsultationTab->ShowWindow(SW_HIDE);
m_TabCtrl.SetWindowPos(NULL, CtrlRect.left, CtrlRect.top, TabRect.Width()+10, TabRect.Height()+30, SWP_NOZORDER);
UpdateData(false);
}
BOOL CLucilleView::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
// TODO: Add your specialized code here and/or call the base class
NMHDR* plomp = (NMHDR*)lParam;
int CurSel;
if (wParam == IDC_TAB)
{
if(plomp->code == TCN_SELCHANGE)
{
CurSel = m_TabCtrl.GetCurSel();
m_PatientTab->ShowWindow(CurSel == 0? SW_SHOW:SW_HIDE);
m_ConsultationTab->ShowWindow(CurSel == 1? SW_SHOW:SW_HIDE);
UpdateData(false);
}
}
return CRecordView::OnNotify(wParam, lParam, pResult);
}