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. SetWindowText()

SetWindowText()

Scheduled Pinned Locked Moved C / C++ / MFC
questiondebugging
4 Posts 4 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.
  • B Offline
    B Offline
    BlackRider
    wrote on last edited by
    #1

    Hello I've got this code CGeneralTab* gentab; CGeneralTab* gentab1; gentab=new CGeneralTab; gentab1=new CGeneralTab; gentab->SetWindowText("xxx"); AddPage(&tab1); AddPage(gentab); AddPage(gentab1); where CGeneralTab is a CPropertyPage derived class. As you can see I wanna create the tabs dinamically but how can I set the tab caption cause calling setwindowtext gives a debug assertion failure message. I've tried setwindowtext from the oninitdialog function of the tab class also but it doesn't work. How do I do that ? Thank you!

    M B B 3 Replies Last reply
    0
    • B BlackRider

      Hello I've got this code CGeneralTab* gentab; CGeneralTab* gentab1; gentab=new CGeneralTab; gentab1=new CGeneralTab; gentab->SetWindowText("xxx"); AddPage(&tab1); AddPage(gentab); AddPage(gentab1); where CGeneralTab is a CPropertyPage derived class. As you can see I wanna create the tabs dinamically but how can I set the tab caption cause calling setwindowtext gives a debug assertion failure message. I've tried setwindowtext from the oninitdialog function of the tab class also but it doesn't work. How do I do that ? Thank you!

      M Offline
      M Offline
      Magnus Westin
      wrote on last edited by
      #2

      Dont know how CPropertyPage works. But I dont think its constructor creates the window. And you cant call SetWindowText until you have created the window.

      1 Reply Last reply
      0
      • B BlackRider

        Hello I've got this code CGeneralTab* gentab; CGeneralTab* gentab1; gentab=new CGeneralTab; gentab1=new CGeneralTab; gentab->SetWindowText("xxx"); AddPage(&tab1); AddPage(gentab); AddPage(gentab1); where CGeneralTab is a CPropertyPage derived class. As you can see I wanna create the tabs dinamically but how can I set the tab caption cause calling setwindowtext gives a debug assertion failure message. I've tried setwindowtext from the oninitdialog function of the tab class also but it doesn't work. How do I do that ? Thank you!

        B Offline
        B Offline
        Brian Delahunty
        wrote on last edited by
        #3

        Have a look here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_mfc_cpropertypage.3a3a.construct.asp[^] Regards, Brian Dela :-)

        1 Reply Last reply
        0
        • B BlackRider

          Hello I've got this code CGeneralTab* gentab; CGeneralTab* gentab1; gentab=new CGeneralTab; gentab1=new CGeneralTab; gentab->SetWindowText("xxx"); AddPage(&tab1); AddPage(gentab); AddPage(gentab1); where CGeneralTab is a CPropertyPage derived class. As you can see I wanna create the tabs dinamically but how can I set the tab caption cause calling setwindowtext gives a debug assertion failure message. I've tried setwindowtext from the oninitdialog function of the tab class also but it doesn't work. How do I do that ? Thank you!

          B Offline
          B Offline
          basementman
          wrote on last edited by
          #4

          Your window is not created until the tab is actually shown. What you need to do is add a member variable to your page class and set the following just prior to calling AddPage(): strcpy(gentab1->m_caTabTitle,"My New Title"); gentab1->m_psp->dwFlags |= PSP_USETITLE; gentab1->m_psp->pszTitle = gentab1->m_caTabTitle;

          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