[MFC] CTabCtrl dans une CDialog
Bonjour,
J'ai encore un souci.
J'ai un CDialog créées visuellement (IDD_RECHERCHECONTENU), que je souhaite intégrer dans le premier onglet d'une CTabCtrl, elle-même contenu dans une autre CDialog.
voila le code:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
// ChoixRecherche.cpp : implementation file
//
#include "stdafx.h"
#include "QuickScan.h"
#include "ChoixRecherche.h"
#include "RechercheContenu.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CChoixRecherche dialog
CChoixRecherche::CChoixRecherche(CWnd* pParent /*=NULL*/)
: CDialog(CChoixRecherche::IDD, pParent)
{
choix[0] = new CRechercheContenu;
//{{AFX_DATA_INIT(CChoixRecherche)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CChoixRecherche::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CChoixRecherche)
DDX_Control(pDX, IDC_CHOIXRECHERCHE, m_Onglets);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CChoixRecherche, CDialog)
//{{AFX_MSG_MAP(CChoixRecherche)
ON_NOTIFY(TCN_SELCHANGE, IDC_CHOIXRECHERCHE, OnChoix)
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CChoixRecherche message handlers
int CChoixRecherche::DoModal()
{
// TODO: Add your specialized code here and/or call the base class
return CDialog::DoModal();
}
BOOL CChoixRecherche::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_Onglets.InsertItem(0, _T("Recherche par contenu"));
BOOL truc = m_Onglets.SetItem(0, reinterpret_cast<TCITEM*>(choix[0]));
choix[0]->Create(IDD_RECHERCHECONTENU, (CWnd*)&m_Onglets);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
} |
où choix est un tableau de CDialog (j'envisage de mettre plusieurs onglets à l'évenir, d'où le tableau). m_onglets est mon CTabCtrl.
Ma boite IDD_RECHERCHECONTENU s'affiche bel et bien, mais pas dans l'onglet. C'est assez fâcheux. Mon code peut paraitre farfelu mais j'ai tellement essayé de truc différents que la j'avoue etre un peu sur les rotules.
Si quelqu'un pouvait m'aider ce serait sympa...