Horrid
Programmer
- May 20, 1999
- 373
I have a class for a token object, when a token object is created it draws information about the token on the screen along with a button. Is it possible to set a message map for this button so it works? Every example I can find assumes I created the cbutton object in my dialog class, I can't find any examples of how to deal with a button that is a member of class.
The very basics are
.h
#define Button_Id someId
class cTokenObject{
public:
cTokenObject(int TokenId);
protected:
afx_msg void OnButtonInterface( );
DECLARE_MESSAGE_MAP()
private:
CButton* cButton
}
.cpp
cTokenObject::cTokenObject(int TokenId){
cButton = new CButton;
cButton->Create(buttoncreationcode, someId);
}
// I think this part is very wrong
BEGIN_MESSAGE_MAP(cTokenObject, cTokenObject)
ON_BN_CLICKED(someId, OnButtonInterface)
END_MESSAGE_MAP()
void cTokenObject::OnButtonInterface(){
// whatever my code here is
}
Is it possible to do this? Am I even half way on the correct track. Not looking for how to do it, just if I can and if I am on the correct track.
The very basics are
.h
#define Button_Id someId
class cTokenObject{
public:
cTokenObject(int TokenId);
protected:
afx_msg void OnButtonInterface( );
DECLARE_MESSAGE_MAP()
private:
CButton* cButton
}
.cpp
cTokenObject::cTokenObject(int TokenId){
cButton = new CButton;
cButton->Create(buttoncreationcode, someId);
}
// I think this part is very wrong
BEGIN_MESSAGE_MAP(cTokenObject, cTokenObject)
ON_BN_CLICKED(someId, OnButtonInterface)
END_MESSAGE_MAP()
void cTokenObject::OnButtonInterface(){
// whatever my code here is
}
Is it possible to do this? Am I even half way on the correct track. Not looking for how to do it, just if I can and if I am on the correct track.