Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. DialogBar to View communication question

DialogBar to View communication question

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++comdebugginglearning
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hiseldl
    wrote on last edited by
    #1

    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/

    R 1 Reply Last reply
    0
    • H hiseldl

      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/

      R Offline
      R Offline
      RobJones
      wrote on last edited by
      #2

      CMyView* pView = (CMyView*)GetActiveView();
      if(pView)
      pView->OnViewBtn();

      That should work.. Rob Whoever said nothing's impossible never tried slamming a revolving door!

      H 1 Reply Last reply
      0
      • R RobJones

        CMyView* pView = (CMyView*)GetActiveView();
        if(pView)
        pView->OnViewBtn();

        That should work.. Rob Whoever said nothing's impossible never tried slamming a revolving door!

        H Offline
        H Offline
        hiseldl
        wrote on last edited by
        #3

        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/

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups