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. Modeless dialog problem

Modeless dialog problem

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.
  • K Offline
    K Offline
    krugger
    wrote on last edited by
    #1

    HI all; I am building an SDI application which has a dockable CDialogBar containing tabs and listControls etc... However,this CDialogBar is modeless. I need to access the list control and dynamically remove or add items to them. The problem is that i just don't know how to access the variable of listcontrol in a modeless dialog. I have tried many methods but it keeps giving me assertion errors since the pointer to the modeless dialog is lost. Could anybody please help me, i badly need this and i need to present this application for my final year project next week. Thank you; Krugger

    E 1 Reply Last reply
    0
    • K krugger

      HI all; I am building an SDI application which has a dockable CDialogBar containing tabs and listControls etc... However,this CDialogBar is modeless. I need to access the list control and dynamically remove or add items to them. The problem is that i just don't know how to access the variable of listcontrol in a modeless dialog. I have tried many methods but it keeps giving me assertion errors since the pointer to the modeless dialog is lost. Could anybody please help me, i badly need this and i need to present this application for my final year project next week. Thank you; Krugger

      E Offline
      E Offline
      Ernesto D
      wrote on last edited by
      #2

      im not much into MFC, but i think this can solve the problem: i assume you are loosing the pointer to the dialog cause you are creating the object inside some function, therefore when the function exits, the pointer is no longer valid (a code sample would have helped). make the pointer a member variable of the class where you want to manipulate the dialog (like CMainFrame), and then you can safely call its members. EG: class CMainFrame { CMyDialogBar* m_pBar; int OnCreate() { m_pBar=new CMyDialogBar; m_pBar->Create(); } void Whatever() { if(m_pBar!=NULL) { // you can access its public member here } } }; this is of course only "sample" code, but should give you an idea of how to do it. HTH

      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