Controls locking up the application in sheet contained within a TabCtrl ( Controls, CDialog and CTabCtrl problems )
Author |
Message |
LongB #1 / 3
|
 Controls locking up the application in sheet contained within a TabCtrl ( Controls, CDialog and CTabCtrl problems )
Hello all, I am having a problem with some controls in a dialog box. Originally I had assert errors, but I have solved this problems ( I think unless what I have done is related to my current problem. ) I have an application who's main window is a dialog box. In this dialog box I have a classed that is derived from CTabCtrl. There is going to be seven tabs with each tab sheet having its own class that is inserted into my derived class. I want each tab sheet to have it own class since it will be doing some processing. Right now I am working on one tab sheet. I have create spin counter using two controls ( CEdit and CSpinButtonCtrl ) using the buddy declaration found in CSpingButtonCtrl. Initially I knew soemthing was wrong since I set some values, but they were not showing up when you first went to the tab sheet. The values I was setting is m_NumOfVAZonesCtrl.SetRange( 0, 10 ); m_NumOfVAZonesCtrl.SetBase( 10 ); m_NumOfVAZonesCtrl.SetPos( 10 ); When you go tab sheet it doesn't start at 10, but 0. In additon whenever you click on any controls ( check box, button spinner control etc.. ) the applications locks up. I have included some source listing to help out. I also found by changing the line m_tabFormPages[5]->Create( IDD_FORM_VA, this ); to m_tabFormPages[5]->Create( IDD_FORM_VA, NULL ); then selecting a control on the tab sheet doesn't lock up the application, but it still isn't displaying the values I initialized it to. The program class structure goes like this.. CSGUIDictionaryGenDlg -> CFormTabCtrl ( a derived CTabCtrl that is in main dialog screen, has 7 tab sheets ) -> CFormVideoAnnouncement ( which is the current tab sheet I am working on that is contained within CFormTabCtrl ) Does anyone have any idea what is causing this? Thanks. I have included some source code, but I have tried to only list code that would he helpful and some code may be excluded from certain methods. Mark Hicks --------------- CFormTabCtrl ------------------------------ class CFormTabCtrl : public CTabCtrl { // Construction public: CFormTabCtrl(); // Implementation public: void SetRectangle(); void Init(); int m_nNumberOfPages; int m_tabCurrentForm; CDialog *m_tabFormPages[7]; virtual ~CFormTabCtrl(); Quote: };
/////////////////////////////////////////////////////////////////////////// // // CFormTabCtrl CFormTabCtrl::CFormTabCtrl() { m_tabFormPages[0] = new CFormEntertainment; m_tabFormPages[1] = new CFormMenu; m_tabFormPages[2] = new CFormOverHeadCrtl; m_tabFormPages[3] = new CFormPFIS; m_tabFormPages[4] = new CFormSeatCtrl; m_tabFormPages[5] = new CFormVideoAnnouncement(this); m_tabFormPages[6] = new CFormVideoDirector; m_nNumberOfPages = 7; Quote: }
///////////////////////////////////////////////////////////////////////////// // CFormTabCtrl message handlers void CFormTabCtrl::Init() { m_tabCurrentForm = 0; m_tabFormPages[0]->Create( IDD_FORM_ENT, this ); m_tabFormPages[1]->Create( IDD_FORM_MENU, this ); m_tabFormPages[2]->Create( IDD_FORM_OVERHEAD, this ); m_tabFormPages[3]->Create( IDD_FORM_PFIS, this ); m_tabFormPages[4]->Create( IDD_FORM_SEATCTRL, this ); m_tabFormPages[5]->Create( IDD_FORM_VA, this ); m_tabFormPages[6]->Create( IDD_FORM_VD, this ); m_tabFormPages[0]->ShowWindow( SW_SHOW ); m_tabFormPages[1]->ShowWindow( SW_HIDE ); m_tabFormPages[2]->ShowWindow( SW_HIDE ); m_tabFormPages[3]->ShowWindow( SW_HIDE ); m_tabFormPages[4]->ShowWindow( SW_HIDE ); m_tabFormPages[5]->ShowWindow( SW_HIDE ); m_tabFormPages[6]->ShowWindow( SW_HIDE ); SetRectangle(); Quote: }
--------------- CFormVideoAnnoucement ------------------------------ class CFormVideoAnnouncement : public CDialog { // Construction public: CFormVideoAnnouncement(CWnd* pParent = NULL); // standard constructor // Dialog Data //{{AFX_DATA(CFormVideoAnnouncement) enum { IDD = IDD_FORM_VA }; CEdit m_NumOfVAZones; CSpinButtonCtrl m_NumOfVAZonesCtrl; //}}AFX_DATA // Implementation protected: virtual BOOL OnInitDialog(); Quote: };
///////////////////////////////////////////////////////////////////////////// // CFormVideoAnnouncement message handlers BOOL CFormVideoAnnouncement::OnInitDialog() { // RECT rc1 = { 100, 100, 120, 120 }; m_NumOfVAZones.Create(0, CRect(100, 100, 120, 120), this, IDC_VA_NUMZONE ); //RECT rc2 = { 100, 100, 120, 130 }; m_NumOfVAZonesCtrl.Create(0, CRect(100, 100, 120, 130), this, IDC_SPIN1); CDialog::OnInitDialog(); m_NumOfVAZonesCtrl.SetRange( 0, 10 ); m_NumOfVAZonesCtrl.SetBase( 10 ); m_NumOfVAZonesCtrl.SetPos( 1 ); return TRUE; Quote: }
--------------- CSGUIDictionaryGenDlg ------------------------------ BOOL CSGUIDictionaryGenDlg::OnInitDialog() { //snip m_tabForms.InsertItem(0, _T("Entertainment") ); m_tabForms.InsertItem(1, _T("Menu") ); m_tabForms.InsertItem(2, _T("Over Head Controls") ); m_tabForms.InsertItem(3, _T("PFIS") ); m_tabForms.InsertItem(4, _T("Seat Controls") ); m_tabForms.InsertItem(5, _T("Video Announcement") ); m_tabForms.InsertItem(6, _T("Video Director") ); m_tabForms.Init(); return TRUE; // return TRUE unless you set the focus to a control Quote: }
|
Tue, 04 Feb 2003 03:00:00 GMT |
|
 |
WL7 #2 / 3
|
 Controls locking up the application in sheet contained within a TabCtrl ( Controls, CDialog and CTabCtrl problems )
Try adding the statement: UpdateData(FALSE); to the OnInitDialog() function, just before returning TRUE.
Quote: > Hello all, > I am having a problem with some controls in a dialog box. Originally I had > assert errors, but I have solved this problems ( I think unless what I have > done is related to my current problem. ) I have an application who's main > window is a dialog box. In this dialog box I have a classed that is derived > from CTabCtrl. There is going to be seven tabs with each tab sheet having > its own class that is inserted into my derived class. > I want each tab sheet to have it own class since it will be doing some > processing. Right now I am working on one tab sheet. I have create spin > counter using two controls ( CEdit and CSpinButtonCtrl ) using the buddy > declaration found in CSpingButtonCtrl. Initially I knew soemthing was wrong > since I set some values, but they were not showing up when you first went to > the tab sheet. The values I was setting is > m_NumOfVAZonesCtrl.SetRange( 0, 10 ); > m_NumOfVAZonesCtrl.SetBase( 10 ); > m_NumOfVAZonesCtrl.SetPos( 10 ); > When you go tab sheet it doesn't start at 10, but 0. In additon whenever > you click on any controls ( check box, button spinner control etc.. ) the > applications locks up. I have included some source listing to help out. I > also found by changing the line > m_tabFormPages[5]->Create( IDD_FORM_VA, this ); > to > m_tabFormPages[5]->Create( IDD_FORM_VA, NULL ); > then selecting a control on the tab sheet doesn't lock up the application, > but it still isn't displaying the values I initialized it to. > The program class structure goes like this.. > CSGUIDictionaryGenDlg > -> CFormTabCtrl ( a derived CTabCtrl that is in main dialog screen, > has 7 tab sheets ) > -> CFormVideoAnnouncement ( which is the current tab sheet I am working > on that is contained within CFormTabCtrl ) > Does anyone have any idea what is causing this? Thanks. I have included some > source code, but I have tried to only list code that would he helpful and some > code may be excluded from certain methods. > Mark Hicks > --------------- CFormTabCtrl ------------------------------ > class CFormTabCtrl : public CTabCtrl > { > // Construction > public: > CFormTabCtrl(); > // Implementation > public: > void SetRectangle(); > void Init(); > int m_nNumberOfPages; > int m_tabCurrentForm; > CDialog *m_tabFormPages[7]; > virtual ~CFormTabCtrl(); > };
/////////////////////////////////////////////////////////////////////////// / / Quote: > // CFormTabCtrl > CFormTabCtrl::CFormTabCtrl() > { > m_tabFormPages[0] = new CFormEntertainment; > m_tabFormPages[1] = new CFormMenu; > m_tabFormPages[2] = new CFormOverHeadCrtl; > m_tabFormPages[3] = new CFormPFIS; > m_tabFormPages[4] = new CFormSeatCtrl; > m_tabFormPages[5] = new CFormVideoAnnouncement(this); > m_tabFormPages[6] = new CFormVideoDirector; > m_nNumberOfPages = 7; > }
//////////////////////////////////////////////////////////////////////////// / Quote: > // CFormTabCtrl message handlers > void CFormTabCtrl::Init() > { > m_tabCurrentForm = 0; > m_tabFormPages[0]->Create( IDD_FORM_ENT, this ); > m_tabFormPages[1]->Create( IDD_FORM_MENU, this ); > m_tabFormPages[2]->Create( IDD_FORM_OVERHEAD, this ); > m_tabFormPages[3]->Create( IDD_FORM_PFIS, this ); > m_tabFormPages[4]->Create( IDD_FORM_SEATCTRL, this ); > m_tabFormPages[5]->Create( IDD_FORM_VA, this ); > m_tabFormPages[6]->Create( IDD_FORM_VD, this ); > m_tabFormPages[0]->ShowWindow( SW_SHOW ); > m_tabFormPages[1]->ShowWindow( SW_HIDE ); > m_tabFormPages[2]->ShowWindow( SW_HIDE ); > m_tabFormPages[3]->ShowWindow( SW_HIDE ); > m_tabFormPages[4]->ShowWindow( SW_HIDE ); > m_tabFormPages[5]->ShowWindow( SW_HIDE ); > m_tabFormPages[6]->ShowWindow( SW_HIDE ); > SetRectangle(); > } > --------------- CFormVideoAnnoucement ------------------------------ > class CFormVideoAnnouncement : public CDialog > { > // Construction > public: > CFormVideoAnnouncement(CWnd* pParent = NULL); // standard constructor > // Dialog Data > file://{{AFX_DATA(CFormVideoAnnouncement) > enum { IDD = IDD_FORM_VA }; > CEdit m_NumOfVAZones; > CSpinButtonCtrl m_NumOfVAZonesCtrl; > file://}}AFX_DATA > // Implementation > protected: > virtual BOOL OnInitDialog(); > };
//////////////////////////////////////////////////////////////////////////// / Quote: > // CFormVideoAnnouncement message handlers > BOOL CFormVideoAnnouncement::OnInitDialog() > { > // RECT rc1 = { 100, 100, 120, 120 }; > m_NumOfVAZones.Create(0, CRect(100, 100, 120, 120), this, IDC_VA_NUMZONE ); > file://RECT rc2 = { 100, 100, 120, 130 }; > m_NumOfVAZonesCtrl.Create(0, CRect(100, 100, 120, 130), this, IDC_SPIN1); > CDialog::OnInitDialog(); > m_NumOfVAZonesCtrl.SetRange( 0, 10 ); > m_NumOfVAZonesCtrl.SetBase( 10 ); > m_NumOfVAZonesCtrl.SetPos( 1 ); > return TRUE; > } > --------------- CSGUIDictionaryGenDlg ------------------------------ > BOOL CSGUIDictionaryGenDlg::OnInitDialog() > { > file://snip > m_tabForms.InsertItem(0, _T("Entertainment") ); > m_tabForms.InsertItem(1, _T("Menu") ); > m_tabForms.InsertItem(2, _T("Over Head Controls") ); > m_tabForms.InsertItem(3, _T("PFIS") ); > m_tabForms.InsertItem(4, _T("Seat Controls") ); > m_tabForms.InsertItem(5, _T("Video Announcement") ); > m_tabForms.InsertItem(6, _T("Video Director") ); > m_tabForms.Init(); > return TRUE; // return TRUE unless you set the focus to a control > }
|
Tue, 04 Feb 2003 03:00:00 GMT |
|
 |
LongB #3 / 3
|
 Controls locking up the application in sheet contained within a TabCtrl ( Controls, CDialog and CTabCtrl problems )
Thanks for the advice, but this still doens't solve the locking up of the program... Mark Quote:
>Try adding the statement: >UpdateData(FALSE); >to the OnInitDialog() function, just before returning TRUE.
>> Hello all, >> I am having a problem with some controls in a dialog box. Originally I >had >> assert errors, but I have solved this problems ( I think unless what I >have >> done is related to my current problem. ) I have an application who's main >> window is a dialog box. In this dialog box I have a classed that is >derived
snip
|
Sat, 08 Feb 2003 13:39:37 GMT |
|
|
|