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. CDialogBar does not support controls

CDialogBar does not support controls

Scheduled Pinned Locked Moved C / C++ / MFC
c++help
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 application which should have a tab control on a CDialogBar. Visual C++ gladly added the dockable dialog bar for me but i could not figure out where to put the code to create the tab control since the OnInitDialog() function is simply ineffective. Can anybody please help out. I need to know where i should place my code to create the TAb control on the dialogbar. I badly need this guys; THanks Krugger

    R 1 Reply Last reply
    0
    • K krugger

      HI all; I am building an application which should have a tab control on a CDialogBar. Visual C++ gladly added the dockable dialog bar for me but i could not figure out where to put the code to create the tab control since the OnInitDialog() function is simply ineffective. Can anybody please help out. I need to know where i should place my code to create the TAb control on the dialogbar. I badly need this guys; THanks Krugger

      R Offline
      R Offline
      Rob Manderson
      wrote on last edited by
      #2

      Let's assume you're trying to create the object using DDX. In other words, you've embedded an object of the correct type in your class definition and written a DoDataExchange function with the appropriate DDX_Control() call. It might look like this (simplified). Header file.

      class CMyDialogBar : public CDialogBar
      {
      public:
      CMyTabbedControl m_tabControl;

      virtual void DoDataExchange(CDataExchange\* pDX);
      virtual void OnInitDialog();
      

      };

      and your implementation file looks like this.

      void CMyDialogBar::DoDataExchange(CDataExchange* pDX)
      {
      CDialogBar::DoDataExchange(pDX);
      DDX_Control(pDX, IDC_MYTABCONTROL, m_tabControl);
      }

      void CMyDialogBar::OnInitDialog()
      {
      CDialogBar::OnInitDialog();

      return TRUE;
      

      }

      And yet it doesn't work. As you've noticed, OnInitDialog() isn't called for a DialogBar. The solution I found was to add a function Initialise() to the DialogBar derived class and call it once I knew the dialog bar had been created.

      void CMyDialogBar::Initialise()
      {
      UpdateData(FALSE);
      }

      Yes, it's that simple. Just call UpdateData() (make sure the call occurs before any code that tries to use the TabControl) and the control will be created. Rob Manderson Colin Davies wrote: I'm sure Americans could use more of it, and thus reduce the world supply faster. This of course would be good, because the faster we run out globally, the less chance of pollution there will be. (Talking about the price of petrol) The Soapbox, March 5 2004

      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