Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 652
  • Last Modified:

CTabCtrl wont display in CPropertyPage

It is simple enougth to use a tab control in a resource based dialog, Just use class wizard to add a CTabCtrl member variable to the tab control then initialize the control   the onInitDialog message handler.

If this approach is used on a resource based CPropertyPage  the the tab control does not display.

How do I get a tab control with an associated CTabCtrl  to display inside a CPropertyPage ?
0
ericpa
Asked:
ericpa
  • 4
  • 3
1 Solution
 
ericpaAuthor Commented:
Edited text of question
0
 
ericpaAuthor Commented:
Adjusted points to 133
0
 
sapekCommented:
This is not a problem with CPropertyPage. I added a tab control to my property page tamplete and the following code to my CPropertyPage derived class OnInitDialog()

TC_ITEM tcItem = {TCIF_TEXT, 0, 0, "Ogólne"};
m_tab.InsertItem(0, &tcItem);

The tab control displays beautifully.
Please try removing everything else from he template but the tab control. If this still doesn't work, check the styles of your dialog and tab control. Here is simplified template of the property page I check it on:

IDD_QUERY DIALOG DISCARDABLE  100, 100, 226, 177
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Warunek"
FONT 8, "MS Sans Serif"
BEGIN
    CONTROL         "Tab1",IDC_TAB1,"SysTabControl32",0x0,167,31,50,30
END

Adam
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
ericpaAuthor Commented:
I'm not sure but I think that it is not that tab control must be first but must be before a group box around it.

Adam
0
 
sapekCommented:
yes you are right. I have tried having group boxes before (in the tab order) the tab control and as long as the group box is not around the tab it all works.

The final solution is that to use a CTabCtrl in a CpropertyPage you must ensure that if the tab control is inside a group box then it must come before the group box in the tab order.
0
 
ericpaAuthor Commented:
In fact I new that when I was first answering your question. The same effect you see with some other controls in a group box (new common control? I haven't check that excactly). I didn't write about this because you can see this effect in VC resource editor preview mode and I thought that you must have previewed your dialog and then you would see that this is not a CPropertyPage problem.

Adam
0
 
sapekCommented:
Adam,

I did notice that I could not see the tabs in preview but as I had not used common controls before I assumed that it was because I had not added any tabs to the control. Thank you for pointing this out to me I will be more carefull when using the new common controls.

Regards Eric
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now