Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamically change the tab labels in a CPropertySheet

I want to instantiate 2 property pages from the same class and template, because the settings they show are basically the same.

CCPUSettingsSheet sheet;
CCPUSettingsPage cpucore1, cpucore2;
sheet.AddPage(&cpucore1);
sheet.AddPage(&cpucore2);

The only problem is that they get the same tab label text, which is the caption field in their resource template. I need to assign a different text to each one, however.

like image 686
sashoalm Avatar asked Mar 30 '12 14:03

sashoalm


1 Answers

Assuming CCPUSettingsPage derives from CPropertyPage, you can use its public m_psp member to access its underlying PROPSHEETPAGE structure. From there, you can write something like:

cpucore1.m_psp.dwFlags |= PSP_USETITLE;
cpucore1.m_psp.pszTitle = "First Tab";

cpucore2.m_psp.dwFlags |= PSP_USETITLE;
cpucore2.m_psp.pszTitle = "Second Tab";
like image 132
Frédéric Hamidi Avatar answered Sep 20 '22 12:09

Frédéric Hamidi