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. Building an Class Wizard looking Dialog

Building an Class Wizard looking Dialog

Scheduled Pinned Locked Moved C / C++ / MFC
question
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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    Hi there! I am trying to build a Dialog-based application which is much like the Visual C Class Wizard. I have played around with a CTabCtrl on the dialog box but I haven't had much luck thus far. Can you give me some hint as to how you would create an application like that? Also, I was wondering whether instead of dumping a CTabCtrl on my dialog, I could attach a CPropertySheet to my CDialog?:confused:

    M 1 Reply Last reply
    0
    • L Lost User

      Hi there! I am trying to build a Dialog-based application which is much like the Visual C Class Wizard. I have played around with a CTabCtrl on the dialog box but I haven't had much luck thus far. Can you give me some hint as to how you would create an application like that? Also, I was wondering whether instead of dumping a CTabCtrl on my dialog, I could attach a CPropertySheet to my CDialog?:confused:

      M Offline
      M Offline
      Manfred Ramosch
      wrote on last edited by
      #2

      If it doesn't bother you that the standard buttons of a property sheet are always there use it. If you do - like I do in my dialog-based-application now - you have to use the CTabCtrl. The difference is that you have to create a dialog for each rider of the tab. The tab itself is just a container. So by selecting the riders of a tab you just call up a user-defined dialog.

      • Put a tab (like IDC_TAB1) in your dialog (CMyDialog) with the dialog editor

      • Open the Class-Wizard and attach a CTabCtrl-Member-Variable (like MyTabCtrl) to your tab-resource (IDC_TAB1)

      • Then you have to tell your tab about the number of riders and their names (with a TC_ITEM structure)

        BOOL CMyDialog::OnInitDialog()
        {
        CDialog::OnInitDialog();

        TC_ITEM TabCtrlItem;
        TabCtrlItem.mask = TCIF_TEXT;

        TabCtrlItem.pszText = "Name of the Rider 1"
        MyTabCtrl.InsertItem(0, &TabCtrlItem);

        TabCtrlItem.pszText = "Name of the Rider 2"
        MyTabCtrl.InsertItem(1, &TabCtrlItem);

        TabCtrlItem.pszText = "Name of the Rider 3"
        MyTabCtrl.InsertItem(2, &TabCtrlItem);
        }

      • Derive a dialog-class (like CMyFirstRiderDialog) from CDialog

      • You should create another dialog resource (like IDD_MY_FIRST_RIDER) that represents the content of your rider

      • In the function void CMyDialog::OnShowWindow(BOOL bShow, UINT nStatus)
        you'll have to create your rider-dialog.

        void CMyDialog::OnShowWindow(BOOL bShow, UINT nStatus)
        {
        CDialog::OnShowWindow(bShow, nStatus)

        if(bShow)
        {
        MyFirstRiderDialog->Create(IDD_MY_FIRST_RIDER, MyTabCtrl.GetActiveWindow());
        MyFirstRiderDialog->ShowWindow(SW_SHOW);
        }
        }

      • In the Message Handler of your TCN_SELCHANGE and TCN_SELCHANGING message of your IDC_TAB1 object
        you have to destroy your MyFirstRiderDialog and create the dialog dedicated to your other tabs.

        void MyDialog::OnSelchangingZone(NMHDR* pNMHDR, LRESULT* pResult)
        {
        switch(MyTabCtrl.GetCurSelection())
        {
        case 0:
        CMyFirstRiderDialog->DestroyWindow();
        break;

        case 1:
        CMySecondRiderDialog->DestroyWindow();
        break;

        default:
        ASSERT(0);
        break:
        }
        }

        void MyDialog::OnSelchangZone(NMHDR* pNMHDR, LRESULT* pResult)
        {
        switch(MyTabCtrl.GetCurSelection())
        {
        ca

      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