Prev: Diff between View, FormView and Dialog???
Next: Increasing the data chunk size when inserting into CRichTextCtrl
From: LudoEN on 16 Oct 2008 11:09 Hi All! I developp a new MFC application and i try to use the new MFC feature pack... Now i've got problems with the CMFCOutlookBar. I want to add tabs into the CMFCOutlookBar control but this tabs come from CDialog I make in the ressource editor. Here is the piece of code: m_studyDlg.Create(IDD_DLG_STUDY, &m_wndOutlookBar); m_imgPropDlg.Create(IDD_DLG_IMG_PROPERTY, &m_wndOutlookBar); CMFCOutlookBarTabCtrl* pOutlookBar = (CMFCOutlookBarTabCtrl*)m_wndOutlookBar.GetUnderlyingWindow(); str.LoadString(IDS_STUDY); pOutlookBar->AddTab(&m_studyDlg, str, -1, FALSE); str.LoadString(IDS_IMG_PROPERTY); pOutlookBar->AddTab(&m_imgPropDlg, str, -1, FALSE); So this code adds my windows correctly but when I close the application and restart, the order od the window is wrong and I've got also the wrong title (the same for each)! Maybe a bug with the SaveState mechanism? If I use the AddControl method like in the MFC Sample, I can't display my CDialog windows! Please, any ideas?
From: LudoEN on 17 Oct 2008 06:41
If someone is interested by this problem, I've got some solutions (after sevral hours of search...). First you can't directly add CDialog in a MFCOutlookBar control because control embedded in the MFCOutlookBar must be derived from CDockablePane to work properly. So one solution is to create a CDialog in the ressource editor for example and add a class with the wizard (CMyDialog) . Then create a class CMyDockablePane derived from CDockablePane class in which you put a member CMyDialog myDlg. You should create the dialog in the OnCreate member function of your CMyDockablePane. Add it should work. The advantage of this method is that you can handle your control events directly form your CMyDialog class! Another solution is to use CPaneDialog. Hope this helps... "LudoEN" wrote: > Hi All! > > I developp a new MFC application and i try to use the new MFC feature pack... > Now i've got problems with the CMFCOutlookBar. I want to add tabs into the > CMFCOutlookBar control but this tabs come from CDialog I make in the > ressource editor. Here is the piece of code: > > m_studyDlg.Create(IDD_DLG_STUDY, &m_wndOutlookBar); > m_imgPropDlg.Create(IDD_DLG_IMG_PROPERTY, &m_wndOutlookBar); > > CMFCOutlookBarTabCtrl* pOutlookBar = > (CMFCOutlookBarTabCtrl*)m_wndOutlookBar.GetUnderlyingWindow(); > > str.LoadString(IDS_STUDY); > pOutlookBar->AddTab(&m_studyDlg, str, -1, FALSE); > > str.LoadString(IDS_IMG_PROPERTY); > pOutlookBar->AddTab(&m_imgPropDlg, str, -1, FALSE); > > So this code adds my windows correctly but when I close the application and > restart, the order od the window is wrong and I've got also the wrong title > (the same for each)! Maybe a bug with the SaveState mechanism? > > If I use the AddControl method like in the MFC Sample, I can't display my > CDialog windows! > > Please, any ideas? > |