DDX/DDV for new common controls
Lawrence_Chan_at_HONGKONG@pcmailgw.ml.com Wednesday, May 29, 1996 VC4.0, NT3.51 I recently posted an article requesting help for writing DDX/DDV routines for new common controls. There have been no reply so I look into the whole thing again and I discover the problem could be solved simply by pretending I am ClassWizard. // Dialog Data //{{AFX_DATA(CFloatdlg) enum { IDD = IDD_DIALOG1 }; CListBox m_ctrllists; CMyslide m_slide; CStringArray m_strlists; << insert this line manually //}}AFX_DATA void CFloatdlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CFloatdlg) DDX_Control(pDX, IDC_MLIST, m_ctrllists); DDX_Control(pDX, IDC_SLIDER1, m_slide); DDX_StringArray(pDX, IDC_MLIST, m_strlists); << insert this line manually //}}AFX_DATA_MAP } IDC_MLIST is a CListCtrl. the framework will automatically fire DDX_StringArray on UpdateData(), just like how the other controls behave.
Niels Ull Jacobsen -- nuj@kruger.dk Wednesday, June 05, 1996 At 12:20 29-05-96 est, you wrote: > VC4.0, NT3.51 > =20 > I recently posted an article requesting help for writing DDX/DDV=20 > routines for new common controls. There have been no reply so I loo= k=20 > into the whole thing again and I discover the problem could be solv= ed=20 > simply by pretending I am ClassWizard. > =20 > // Dialog Data > //{{AFX_DATA(CFloatdlg) > enum { IDD =3D IDD_DIALOG1 }; > CListBox m_ctrllists; > CMyslide m_slide; > CStringArray m_strlists; << insert this line manually > //}}AFX_DATA > =20 > void CFloatdlg::DoDataExchange(CDataExchange* pDX) > { > CDialog::DoDataExchange(pDX); > //{{AFX_DATA_MAP(CFloatdlg) > DDX_Control(pDX, IDC_MLIST, m_ctrllists); > DDX_Control(pDX, IDC_SLIDER1, m_slide); > DDX_StringArray(pDX, IDC_MLIST, m_strlists); << insert this line= =20 > manually > //}}AFX_DATA_MAP > } > =20 > =20 > IDC_MLIST is a CListCtrl. > =20 > the framework will automatically fire DDX_StringArray on UpdateData= (),=20 > just like how the other controls behave. I'd seriously suggest moving those lines *outside* the classwizard commen= ts. It'll work just as well, but you won't run the risk of ClassWizard gettin= g=20 confused when trying to parse your routines. Or deleting them at some poi= nt. ClassWizard is just a smart code-writer, and the delimiter comments are j= ust that - comments. They have *no* influence on *anything* but ClassWizard. Niels Ull Jacobsen, Kr=FCger A/S (nuj@kruger.dk) Everything stated herein is THE OFFICIAL POLICY of the entire Kruger=20 group and should be taken as legally binding in every respect.=20 Pigs will grow wings and fly.
| Вернуться в корень Архива |