Referring CChildFrame variable
-
Hi, In my application im loading DialogBar in mainfrmae,the dialogbar contains buttons and one ComboBox, i using that ComboBox in another class.Below is the code: In MainFrm.h:
CSysWindow m_SysWnd; //CSysWindow is DialogBar class.
For that combobox i added one class as CAlarmGlobal In SysWindow.h:
CAlarmCombo oAlrmCombo; //CAlarmCombo derived from CComboBox
In MainFrm.cpp,in OnCreate() i add that dialogbar to mainframe
if (!m_SysWnd.Create(this, IDD_SYS,
CBRS_TOP|CBRS_FLYBY|CBRS_TOOLTIPS, IDD_SYS))
{
return -1;
}In another class im reffering this ComboBox by using this code
CAlarmCombo *pSysBox = (CAlarmCombo *)((CMainFrame *)AfxGetMainWnd())->m_SysWnd.GetDlgItem(IDC_SYSALARM); //Combobox ID
if(pSysBox){}Like the sameway i want to give the dialogbar in childframe and i want to use tht in differnt class. So i want to know how can i get the DialogBar class(CSyswindow) object in someother class. Now im doing the same for ChildFrame In ChildFrm.h:
CSysWindow m_Recent; //CSysWindow is DialogBar class
In ChildFrame.cpp,OnCreate()
if( !m_Recent.Create(this, IDD_RECENTALARMS, CBRS_BOTTOM |CBRS_FLYBY|CBRS_SIZE_DYNAMIC, IDD_RECENTALARMS ))
{
return -1; // fail to create
}I want tot know,Is there anyway to refer the childframe like this
((CMainFrame *)AfxGetMainWnd())->m_SysWnd.GetDlgItem(IDC_SYSALARM);
Pls help me.
Anu