Click here to Skip to main content
15,887,214 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Connection String Couldn't Connect Pin
Victor Nijegorodov16-Mar-18 8:41
Victor Nijegorodov16-Mar-18 8:41 
GeneralRe: Connection String Couldn't Connect Pin
leon de boer18-Mar-18 4:20
leon de boer18-Mar-18 4:20 
AnswerRe: Connection String Couldn't Connect Pin
leon de boer15-Mar-18 16:49
leon de boer15-Mar-18 16:49 
GeneralRe: Connection String Couldn't Connect Pin
Brennan Salibrici16-Mar-18 2:45
Brennan Salibrici16-Mar-18 2:45 
QuestionRe: Connection String Couldn't Connect Pin
David Crow16-Mar-18 16:43
David Crow16-Mar-18 16:43 
Questionproblem in operator overloading of >> & << ? Pin
Tarun Jha15-Mar-18 7:47
Tarun Jha15-Mar-18 7:47 
AnswerRe: problem in operator overloading of >> & << ? Pin
CPallini15-Mar-18 10:47
mveCPallini15-Mar-18 10:47 
QuestionCan we include two Message Maps in one class? Pin
Sampath57914-Mar-18 23:23
Sampath57914-Mar-18 23:23 
Hi
I have a class which derives from CScrollView and i have a message map in it whose base class is CScrollView as follows:

class MyClass : public CScrollView
{

    public : 
             DECLARE_MESSAGE_MAP();
             void OnButtonSelect();
             void Init();
             CButton m_button;

}

// In .cpp file

BEGIN_MESSAGE_MAP(MyClass , CScrollView)

        ON_COMMAND(ID_FILE_PRINT, OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, OnFilePrintPreview)
        ON_BN_CLICKED(1010, OnButtonSelect)

END_MESSAGE_MAP()

MyClass::Init()
{
  m_button.Create(_T("Hi"),, BS_PUSHBUTTON, CRect(0, 0, 80, 20), m_cdRadViewer, 1010);
  m_button.ShowWindow(SW_SHOW);
}

MyClass:OnButtonSelect()
{
  AfxMessageBox(_T("hi, button Clicked"));
}

In the above code, when i click on button, OnButtonSelect() is not getting called even i added the button notification message in Message Map. After investigation i understood, the Base class mentioned in Message map and my class is from CScrollView and it cannot inherit the button features.
If this is true, how can i access the button message in my function.

I want to create the buttons in runtime and want to do some operation based on the button click.
Is it possible to notify in case if my class is derived from CScrollView?

modified 15-Mar-18 5:40am.

AnswerRe: Can we include two Message Maps in one class? Pin
Richard MacCutchan14-Mar-18 23:32
mveRichard MacCutchan14-Mar-18 23:32 
GeneralRe: Can we include two Message Maps in one class? Pin
Sampath57914-Mar-18 23:39
Sampath57914-Mar-18 23:39 
AnswerRe: Can we include two Message Maps in one class? Pin
Jochen Arndt15-Mar-18 0:53
professionalJochen Arndt15-Mar-18 0:53 
GeneralRe: Can we include two Message Maps in one class? Pin
Sampath57915-Mar-18 1:08
Sampath57915-Mar-18 1:08 
GeneralRe: Can we include two Message Maps in one class? Pin
Sampath57915-Mar-18 4:19
Sampath57915-Mar-18 4:19 
GeneralRe: Can we include two Message Maps in one class? Pin
Victor Nijegorodov15-Mar-18 4:48
Victor Nijegorodov15-Mar-18 4:48 
GeneralRe: Can we include two Message Maps in one class? Pin
Sampath57915-Mar-18 6:25
Sampath57915-Mar-18 6:25 
GeneralRe: Can we include two Message Maps in one class? Pin
Jochen Arndt15-Mar-18 4:50
professionalJochen Arndt15-Mar-18 4:50 
GeneralRe: Can we include two Message Maps in one class? Pin
Sampath57915-Mar-18 6:57
Sampath57915-Mar-18 6:57 
GeneralRe: Can we include two Message Maps in one class? Pin
Richard MacCutchan15-Mar-18 7:11
mveRichard MacCutchan15-Mar-18 7:11 
GeneralRe: Can we include two Message Maps in one class? Pin
Sampath57915-Mar-18 7:31
Sampath57915-Mar-18 7:31 
GeneralRe: Can we include two Message Maps in one class? Pin
Richard MacCutchan15-Mar-18 8:03
mveRichard MacCutchan15-Mar-18 8:03 
QuestionHow to reuse a single CView class with multiple tabs in MFC Pin
Sampath57914-Mar-18 6:42
Sampath57914-Mar-18 6:42 
AnswerRe: How to reuse a single CView class with multiple tabs in MFC Pin
Richard MacCutchan14-Mar-18 7:06
mveRichard MacCutchan14-Mar-18 7:06 
AnswerRe: How to reuse a single CView class with multiple tabs in MFC Pin
_Flaviu14-Mar-18 21:58
_Flaviu14-Mar-18 21:58 
AnswerRe: How to reuse a single CView class with multiple tabs in MFC Pin
_Flaviu14-Mar-18 22:41
_Flaviu14-Mar-18 22:41 
GeneralRe: How to reuse a single CView class with multiple tabs in MFC Pin
Sampath57914-Mar-18 22:55
Sampath57914-Mar-18 22:55 

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.