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. Send informations to a splitter windows (List View))

Send informations to a splitter windows (List View))

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorial
2 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.
  • F Offline
    F Offline
    Francis B
    wrote on last edited by
    #1

    I have a SDI application. My view is split into 2 parts. One of these windows is a List View. The user has the possibility of adding an item in the list view from a dialog. My problem is that I don't know how to get the information of the list view to call the function which to add items. I tried the code below but it doesn't seem to work. CMainFrame *pMainFrame=(CMainFrame*)AfxGetMainWnd(); CDocument * pDoc = ((CView *)pMainFrame->m_wndSplitter.GetPane(0,0))->GetDocument(); CBOFListView* prt = (CBOFListView*)pDoc->GetRuntimeClass(); prt->AddItemToList(Item); //AddItemToList is the function used to add items Thanks Regards!!

    B 1 Reply Last reply
    0
    • F Francis B

      I have a SDI application. My view is split into 2 parts. One of these windows is a List View. The user has the possibility of adding an item in the list view from a dialog. My problem is that I don't know how to get the information of the list view to call the function which to add items. I tried the code below but it doesn't seem to work. CMainFrame *pMainFrame=(CMainFrame*)AfxGetMainWnd(); CDocument * pDoc = ((CView *)pMainFrame->m_wndSplitter.GetPane(0,0))->GetDocument(); CBOFListView* prt = (CBOFListView*)pDoc->GetRuntimeClass(); prt->AddItemToList(Item); //AddItemToList is the function used to add items Thanks Regards!!

      B Offline
      B Offline
      Ben Burnett
      wrote on last edited by
      #2

      Try moving the creation of the dialog into a handler in the list view class. Then all you can just pass a pointer to the view to the dialog in the dialog's ctor.

      CYourDialog wndYourDialog ( this /* the view */ );

      Where your dialog's ctor looks something like this;

      CYourDialog::CYourDialog ( CYourView * pView ) : m_pTheView ( pView ) {}

      Then just add the items to the view from the dialog throught the pointer to the view. Ben Burnett --------- On the topic of code with no error handling -- It's not poor coding, it's "optimistic" ;)

      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