Click here to Skip to main content
16,005,048 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: create a batch of button in code, and the BN_CLICKED messages map to one function onButtonClick()? Pin
Cedric Moonen9-May-06 23:44
Cedric Moonen9-May-06 23:44 
GeneralRe: create a batch of button in code, and the BN_CLICKED messages map to one function onButtonClick()? Pin
zeus_master10-May-06 20:38
zeus_master10-May-06 20:38 
GeneralRe: create a batch of button in code, and the BN_CLICKED messages map to one function onButtonClick()? Pin
Cedric Moonen10-May-06 20:42
Cedric Moonen10-May-06 20:42 
GeneralRe: create a batch of button in code, and the BN_CLICKED messages map to one function onButtonClick()? Pin
Cedric Moonen10-May-06 20:48
Cedric Moonen10-May-06 20:48 
GeneralRe: create a batch of button in code, and the BN_CLICKED messages map to one function onButtonClick()? Pin
zeus_master10-May-06 21:15
zeus_master10-May-06 21:15 
GeneralRe: create a batch of button in code, and the BN_CLICKED messages map to one function onButtonClick()? Pin
Cedric Moonen10-May-06 21:24
Cedric Moonen10-May-06 21:24 
GeneralRe: create a batch of button in code, and the BN_CLICKED messages map to one function onButtonClick()? Pin
zeus_master10-May-06 21:38
zeus_master10-May-06 21:38 
GeneralRe: create a batch of button in code, and the BN_CLICKED messages map to one function onButtonClick()? Pin
Cedric Moonen10-May-06 21:51
Cedric Moonen10-May-06 21:51 
Ok, then it is because the CButton class doesn't allow 'copying' itself (needed to be stored in the vector).
Then, we can go the 'old way' Wink | ;) : just use a plain C array:
CButton* m_pButtons;

And in the constructor:
m_pButtons = NULL;

In the destructor:
if (m_pButtons)
{
    delete[] m_pButtons;
    m_pButtons = NULL;
}


In OnInitDialog:
m_pButtons = new CButton(10);
for (int i=0;i<10;i++)
    m_pButtons[i].Create(.....);


Sorry for the time lost Sigh | :sigh:
AnswerRe: creat a batch of button in code, and the BN_CLICKED messages map to one function onButtonClick()? Pin
Cedric Moonen9-May-06 21:17
Cedric Moonen9-May-06 21:17 
GeneralRe: creat a batch of button in code, and the BN_CLICKED messages map to one function onButtonClick()? Pin
zeus_master9-May-06 23:36
zeus_master9-May-06 23:36 
Questionhelp Pin
subikchya9-May-06 21:09
subikchya9-May-06 21:09 
AnswerRe: help Pin
VinayCool9-May-06 21:28
VinayCool9-May-06 21:28 
AnswerRe: help Pin
Hamid_RT9-May-06 21:37
Hamid_RT9-May-06 21:37 
GeneralRe: help Pin
subikchya19-May-06 6:43
subikchya19-May-06 6:43 
GeneralRe: help Pin
Hamid_RT19-May-06 19:04
Hamid_RT19-May-06 19:04 
AnswerRe: help Pin
_AnsHUMAN_ 9-May-06 21:57
_AnsHUMAN_ 9-May-06 21:57 
AnswerRe: help Pin
LittleYellowBird9-May-06 22:00
LittleYellowBird9-May-06 22:00 
GeneralRe: help Pin
subikchya19-May-06 6:47
subikchya19-May-06 6:47 
AnswerRe: help Pin
Aqueel9-May-06 22:34
Aqueel9-May-06 22:34 
AnswerRe: help Pin
Maxwell Chen9-May-06 22:51
Maxwell Chen9-May-06 22:51 
GeneralRe: help Pin
Hamid_RT9-May-06 23:54
Hamid_RT9-May-06 23:54 
GeneralRe: help Pin
Maxwell Chen10-May-06 0:13
Maxwell Chen10-May-06 0:13 
QuestionSymbol Already defined... Pin
Polite Programmer9-May-06 20:50
Polite Programmer9-May-06 20:50 
AnswerRe: Symbol Already defined... Pin
Nibu babu thomas9-May-06 20:56
Nibu babu thomas9-May-06 20:56 
AnswerRe: Symbol Already defined... Pin
Stephen Hewitt9-May-06 21:02
Stephen Hewitt9-May-06 21:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.