CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 1999
    Posts
    48

    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 ?


  2. #2
    Join Date
    Aug 1999
    Posts
    24

    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


  3. #3
    Join Date
    Jul 1999
    Posts
    48

    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);
    ....
    }




  4. #4
    Join Date
    Aug 1999
    Posts
    24

    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


  5. #5
    Join Date
    Jul 1999
    Posts
    48

    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


  6. #6
    Join Date
    Aug 1999
    Posts
    24

    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



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured