Simple Way to Check All Dialog Controls for Changings
Posted
by Ramin Sadeghi
on May 6th, 2000
ON_CONTROL_RANGE ( wNotifyCode, id1, id2, memberFxn )
Use this macro to map a contiguous range of control IDs to a single message handler function for a specified Windows notification message. ClassWizard does not support creating an ON_CONTROL_RANGE handler in the user interface, so you must place the macro yourself. Be sure to put it outside the message map //{{AFX_MSG_MAP delimiters. Once entered, ClassWizard will parse these entries and allow you to browse them just like any other message map entries.


Usage
- Add the message handlers declaration...
- Declare the function in your header file that way:
- And finally code your 'OnRangeUpdate...' functions that way:
BEGIN_MESSAGE_MAP(CMyDlg, CDialog)
//{{AFX_MSG_MAP(CMyDlg)
ON_WM_CREATE()
//}}AFX_MSG_MAP
ON_CONTROL_RANGE(EN_CHANGE, IDC_EDIT1, IDC_EDIT3, OnRangeUpdateED)
ON_CONTROL_RANGE(BN_CLICKED , IDC_RADIO1, IDC_RADIO8, OnRangeUpdateRB)
ON_CONTROL_RANGE(BN_KILLFOCUS , IDC_CHECK1, IDC_CHECK6, OnRangeUpdateCB)
END_MESSAGE_MAP()
class CMyDlg : public CDialog
{
public:
BOOL m_bUpdateED;
BOOL m_bUpdateRB;
BOOL m_bUpdateCB;
...
protected:
// Generated message map functions
//{{AFX_MSG(CMyDlg)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
virtual BOOL OnInitDialog();
virtual void OnOK();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
virtual void OnRangeUpdateED(UINT nID);
virtual void OnRangeUpdateRB(UINT nID);
virtual void OnRangeUpdateCB(UINT nID);
};
void CMyDlg::OnRangeUpdateED(UINT nID)
{
// extra check
if ( SendDlgItemMessage(nID, EM_GETMODIFY, 0, 0) )
m_bUpdateED = TRUE;
else
m_bUpdateED = FALSE;
}
void CMyDlg::OnRangeUpdateRB(UINT nID)
{
// for example
if ( nID == IDC_RADIO3 )
m_bUpdateRB = TRUE;
else
m_bUpdateRB = FALSE;
}
void CMyDlg::OnRangeUpdateCB(UINT nID)
{
// for example
LRESULT lResult = SendDlgItemMessage(nID, BM_GETSTATE, 0, 0);
if ( lResult == BST_CHECKED )
m_bUpdateCB = TRUE;
else
m_bUpdateCB = FALSE;
}
void CMyDlg::OnOK()
{
if ( m_bUpdateRB )
// ...
CDialog::OnOK();
}

Comments
Those things everybody else does with nike and those actions you want to do totally different.
Posted by icoppyapedcap on 04/21/2013 08:20pmDw [url=http://hunter-rain-boots.webnode.jp]ãã³ã¿ã¼ãã¼ã[/url] nMy [url=http://hunterrainbootsjp.webnode.jp]ãã³ã¿ã¼ãã¼ã[/url] f WpoKjf YiaV [url=http://hunter-boots8.webnode.jp]ã¬ã¤ã³ãã¼ãã¡ã³ãº[/url] rn A [url=http://rain-boots-men.webnode.jp]ãã¼ã[/url] oc [url=http://hunter-rain-boots-ja.webnode.jp]ã¬ã¤ã³ãã¼ãã¡ã³ãº[/url] CnsCaiDpq O[url=http://rainshoesja.webnode.jp]ã¬ã¤ã³ãã¼ã[/url] rwDvgCshLv [url=http://ja-hunter-rain-boots.webnode.jp]ã¬ã¤ã³ãã¼ããã³ã¿ã¼[/url] s HetPxt [url=http://rain-boots-popular.webnode.jp]ã¬ã¤ã³ãã¼ã人æ°[/url] Zbv [url=http://rain-boots-men6.webnode.jp]ã¬ã¤ã³ãã¼ããã³ã¿ã¼[/url] Dan Jhn [url=http://jahunterrainboots.webnode.jp]ãã³ã¿ã¼ãã¼ã[/url] Lug
ReplyPerfect
Posted by Legacy on 05/22/2003 12:00amOriginally posted by: Ben Dunaway
I am still learning MFC and finding solutions to common problems can get lengthy. Thanks for the for you effort, the CONTROL_RANGE macro is perfect.
Replyquestion?
Posted by Legacy on 08/07/2002 12:00amOriginally posted by: PERAS
can i use this with edit boxes! if i can how!
Replyi tried it and it didn't work