Weird behaviour of TabCtrl
I modified a TabCtrl of a PropertySheet so that it is Multiline and FixedWidth. I did this by :
GetDlgItem(AFX_IDC_TAB_CONTROL)->ModifyStyle(0, TCS_FIXEDWIDTH | TCS_MULTILINE);
and then i modified the width of the Control with the following code :
GetDlgItem(AFX_IDC_TAB_CONTROL)->SendMessage(TCM_SETITEMSIZE, 0, MAKELPARAM(210, 20));
When i run the program, i get the 6 tabs. 3 tabs are in the front line and the rest in the back one.
The problem is that somehow the TabCtrl still
thinks its one line, and thus, the first PropertyPage
gets drawn over the set of tabs that is on the
front. When i click on another tab, the control
realizes it has 2 rows of tabs and now draws
the PropertyPage correctly.
Any idea on what is wrong ?
Re: Weird behaviour of TabCtrl
It might be a timing problem, try to change the SendMessage to a Post, even though each function is being done, they might be leaving it in an unstable state that it eventually cleans up.
If that doesn't help, maybe you could post some more of the code, and where its being called from (OnInitDialog, etc.).
Good Luck,
John
Re: Weird behaviour of TabCtrl
This is the piece of code that matters for this
problem :
BOOL CMyPropertySheet::OnInitDialog()
{
....
GetDlgItem(AFX_IDC_TAB_CONTROL)->PostMessage(TCM_SETITEMSIZE, 0, MAKELPARAM(210, 20));
GetDlgItem(AFX_IDC_TAB_CONTROL)->ModifyStyle(0, TCS_FIXEDWIDTH | TCS_MULTILINE);
....
}
Re: Weird behaviour of TabCtrl
Ok, still seems like either a timing problem, or a bug(!), let me try to set this up, see if I can re-create it, I'll be back to you ASAP. BTW, what VC++ are you using?
John
Re: Weird behaviour of TabCtrl
I am usingc VC++ 5.0.
I can send you the complete source code if you want, its just the beggining of a project, so there is no code, just the crazy PropertySheet.
Thanks :)
Re: Weird behaviour of TabCtrl
I've tried what you describe, a basic propertysheet with 6 tabs, then change its style and post the size message. All seems to work fine. Maybe you could send me the code thats creating your pages, I'm doing something like this:
AddPage(&m_proptestPage1);
AddPage(&m_proptestPage2);
AddPage(&m_proptestPage3);
AddPage(&m_proptestPage4);
AddPage(&m_proptestPage5);
AddPage(&m_proptestPage6);
Is yours more involved/different perhaps, Sorry I can't help further :(
Regards,
John