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. Dynamically Setting Tab Title on Propertysheet

Dynamically Setting Tab Title on Propertysheet

Scheduled Pinned Locked Moved C / C++ / MFC
data-structureshelpquestionannouncement
3 Posts 3 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.
  • J Offline
    J Offline
    John Clump
    wrote on last edited by
    #1

    Hi everyone. I have a dialog with a propertysheet with a tab control style. The propertysheet has 5 propertypages, all of the same class. I want each tab to have a different title on it, eg. "One", "Two", etc. Since they are all of the same class, I can't set the title statically. In the propertypage's OnInitDialog() I try to set the title, but it won't change the title on the tab. Is there a way to set the tab titles in the propertypage's OnInitDialog()? I could create 5 different dialog classes for each propertypage and could set the title statically, but that would be wasteful. I use the code below. It doesn't set the title. It also crashes when the program is in release mode, which I can't understand. Thanks for any help! BOOL CDlgMyDialog::OnInitDialog() { CDialog::OnInitDialog(); //... // m_ppgMyPropPages is an array of m_ppgMyPropPage for(i = 0; i < 5; ++i) { m_ppgMyPropPages[i].SetMode(i); m_ppsMyPropSheet.AddPage(&m_ppgMyPropPage[i]); } // create the sheet m_ppsMyPropSheet.Create(this, WS_CHILD | WS_VISIBLE, 0); m_ppsMyPropSheet.ModifyStyleEx(0, WS_EX_CONTROLPARENT); m_ppsMyPropSheet.ModifyStyle(0, WS_TABSTOP); CRect rcSheet; GetDlgItem(IDC_PPS_MAIN)->GetWindowRect(&rcSheet); ScreenToClient(&rcSheet); m_ppsMyPropSheet.SetWindowPos(NULL, rcSheet.left- 7, rcSheet.top - 7, 0, 0, SWP_NOZORDER | SWP_NOSIZE); //... } BOOL CPpgMyPropPage::OnInitDialog() { CPropertyPage::OnInitDialog(); if(m_iMode == 0) SetWindowText("One"); if(m_iMode == 1) SetWindowText("Two"); if(m_iMode == 2) SetWindowText("Three"); if(m_iMode == 3) SetWindowText.SetWindowText("Four"); if(m_iMode == 4) SetWindowText.SetWindowText("Five"); //.... }

    J V 2 Replies Last reply
    0
    • J John Clump

      Hi everyone. I have a dialog with a propertysheet with a tab control style. The propertysheet has 5 propertypages, all of the same class. I want each tab to have a different title on it, eg. "One", "Two", etc. Since they are all of the same class, I can't set the title statically. In the propertypage's OnInitDialog() I try to set the title, but it won't change the title on the tab. Is there a way to set the tab titles in the propertypage's OnInitDialog()? I could create 5 different dialog classes for each propertypage and could set the title statically, but that would be wasteful. I use the code below. It doesn't set the title. It also crashes when the program is in release mode, which I can't understand. Thanks for any help! BOOL CDlgMyDialog::OnInitDialog() { CDialog::OnInitDialog(); //... // m_ppgMyPropPages is an array of m_ppgMyPropPage for(i = 0; i < 5; ++i) { m_ppgMyPropPages[i].SetMode(i); m_ppsMyPropSheet.AddPage(&m_ppgMyPropPage[i]); } // create the sheet m_ppsMyPropSheet.Create(this, WS_CHILD | WS_VISIBLE, 0); m_ppsMyPropSheet.ModifyStyleEx(0, WS_EX_CONTROLPARENT); m_ppsMyPropSheet.ModifyStyle(0, WS_TABSTOP); CRect rcSheet; GetDlgItem(IDC_PPS_MAIN)->GetWindowRect(&rcSheet); ScreenToClient(&rcSheet); m_ppsMyPropSheet.SetWindowPos(NULL, rcSheet.left- 7, rcSheet.top - 7, 0, 0, SWP_NOZORDER | SWP_NOSIZE); //... } BOOL CPpgMyPropPage::OnInitDialog() { CPropertyPage::OnInitDialog(); if(m_iMode == 0) SetWindowText("One"); if(m_iMode == 1) SetWindowText("Two"); if(m_iMode == 2) SetWindowText("Three"); if(m_iMode == 3) SetWindowText.SetWindowText("Four"); if(m_iMode == 4) SetWindowText.SetWindowText("Five"); //.... }

      J Offline
      J Offline
      Joan M
      wrote on last edited by
      #2

      Take a look at this... in the Constructor of the property sheet...

      this->AddPage(&this->m_PPDlgParametritzacioDirectaEixos);
      this->m_PPDlgParametritzacioDirectaEixos.m_psp.dwFlags |= PSP_USETITLE;
      this->m_PPDlgParametritzacioDirectaEixos.m_psp.pszTitle = "Ejes";

      Hope this helps...

      1 Reply Last reply
      0
      • J John Clump

        Hi everyone. I have a dialog with a propertysheet with a tab control style. The propertysheet has 5 propertypages, all of the same class. I want each tab to have a different title on it, eg. "One", "Two", etc. Since they are all of the same class, I can't set the title statically. In the propertypage's OnInitDialog() I try to set the title, but it won't change the title on the tab. Is there a way to set the tab titles in the propertypage's OnInitDialog()? I could create 5 different dialog classes for each propertypage and could set the title statically, but that would be wasteful. I use the code below. It doesn't set the title. It also crashes when the program is in release mode, which I can't understand. Thanks for any help! BOOL CDlgMyDialog::OnInitDialog() { CDialog::OnInitDialog(); //... // m_ppgMyPropPages is an array of m_ppgMyPropPage for(i = 0; i < 5; ++i) { m_ppgMyPropPages[i].SetMode(i); m_ppsMyPropSheet.AddPage(&m_ppgMyPropPage[i]); } // create the sheet m_ppsMyPropSheet.Create(this, WS_CHILD | WS_VISIBLE, 0); m_ppsMyPropSheet.ModifyStyleEx(0, WS_EX_CONTROLPARENT); m_ppsMyPropSheet.ModifyStyle(0, WS_TABSTOP); CRect rcSheet; GetDlgItem(IDC_PPS_MAIN)->GetWindowRect(&rcSheet); ScreenToClient(&rcSheet); m_ppsMyPropSheet.SetWindowPos(NULL, rcSheet.left- 7, rcSheet.top - 7, 0, 0, SWP_NOZORDER | SWP_NOSIZE); //... } BOOL CPpgMyPropPage::OnInitDialog() { CPropertyPage::OnInitDialog(); if(m_iMode == 0) SetWindowText("One"); if(m_iMode == 1) SetWindowText("Two"); if(m_iMode == 2) SetWindowText("Three"); if(m_iMode == 3) SetWindowText.SetWindowText("Four"); if(m_iMode == 4) SetWindowText.SetWindowText("Five"); //.... }

        V Offline
        V Offline
        vikramlinux
        wrote on last edited by
        #3

        Just Have a Look at the http://www.codeguru.com/forum/printthread.php?threadid=224993

        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