DialogBar to View communication question
-
I'm using VC6, and created an MFC app through the app wizard selecting the Internet Explorer ReBars option. This puts a CDialogBar in the CMainFrame class. Using the resource editor I added an Edit control and a button to the dialogbar, named IDC_EDIT and IDC_BTN. I added a command message through the class wizard that maps the button to an OnBtn method in CMainFrame. I put a breakpoint in the method, and when I press the button, the app stops at the breakpoint. So, how do I call CMyView::OnViewBtn() in my view class from the CMainFrame::OnBtn() method? Thanks. David Hisel -- http://www.hisel.com/
-
I'm using VC6, and created an MFC app through the app wizard selecting the Internet Explorer ReBars option. This puts a CDialogBar in the CMainFrame class. Using the resource editor I added an Edit control and a button to the dialogbar, named IDC_EDIT and IDC_BTN. I added a command message through the class wizard that maps the button to an OnBtn method in CMainFrame. I put a breakpoint in the method, and when I press the button, the app stops at the breakpoint. So, how do I call CMyView::OnViewBtn() in my view class from the CMainFrame::OnBtn() method? Thanks. David Hisel -- http://www.hisel.com/
-
CMyView* pView = (CMyView*)GetActiveView();
if(pView)
pView->OnViewBtn();That should work.. Rob Whoever said nothing's impossible never tried slamming a revolving door!
Nope, it doesn't seem to work. Here is what I have:
void CMainFrame::OnBtn() { CMyView* pView = (CMyView*)GetActiveView(); if (pView) pView->OnViewBtn(); }
pView is NULL every time I press the button, hence, no call to OnViewBtn(). Is there a way to send a message to the view class? Would that work? David Hisel -- http://www.hisel.com/