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