CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Guest

    ctabCtrl & multiline

    hello,

    if you have a solution to my problem, my email :
    [email protected]

    I don't know how customize the number of tabs into a multiline in cDialog window ?
    And, thus do like a carriage control on the end of each line !!!!

    Now, I use a string table for each title :
    BOOL CAdmDlg::OnInitDialog()
    {
    CDialog::OnInitDialog();
    // Tab labels
    Label.LoadString(IDS_STR_TAB_TITLE1);
    tcItem.pszText = Label.GetBuffer(0);
    m_TabControl.InsertItem(TAB_TITLE1, &tcItem);

    Label.LoadString(IDS_STR_TAB_TITLE2);
    tcItem.pszText = Label.GetBuffer(0);
    m_TabControl.InsertItem(TAB_TITLE2, &tcItem);

    Label.LoadString(IDS_STR_TAB_TITLE3);
    tcItem.pszText = Label.GetBuffer(0);
    m_TabControl.InsertItem(TAB_TITLE3, &tcItem);

    ...

    }

    For example :
    2 tabs in line 1
    4 tabs in line 2
    and 1 tab in line 3

    -----------------------------
    |....title1...|....title2...|
    -----------------------------
    |title1|title2|title3|title4|
    -----------------------------
    |..........title5...........|
    -----------------------------
    |...........................|
    |...........................|
    |...........................|
    |...........................|
    |...........................|
    |...........................|
    |...........................|
    |...........................|
    |...........................|
    |...........................|
    |...........................|
    |...........................|
    -----------------------------

    thinks for your answer


  2. #2
    Join Date
    Apr 1999
    Location
    WA, USA
    Posts
    15

    Work around I can think of, but not that smooth.

    //here is a work around
    //add spaces to the captions of tabs as per
    //number of tabs you want per line.
    //the more tabs, the less spaces..
    //I have put '*'s for captions 2,3,4,6,8,9 below.
    //You should be using spaces instead.
    //One important thing to note is width of the
    //tab control, which holds the key.

    CString str[10];
    str[0] = "item 1";
    str[1] = "item 2***************************************";
    str[2] = "item 3**************";
    str[3] = "item 4*********";
    str[4] = "item 5";
    str[5] = "item 6**************************";
    str[6] = "item 7";
    str[7] = "item 8*************";
    str[8] = "item 9*****************************";
    str[9] = "item 10***********";

    TC_ITEM ti;
    ti.mask = TCIF_TEXT;
    for (int i = 0; i < 10; i++)
    {
    ti.pszText = str[ i ].GetBuffer(str[ i ].GetLength());
    m_tab1.InsertItem( i, &ti);
    }



  3. #3
    Guest

    Re: ctabCtrl & multiline

    Yes, it's correct. But, if we want to use a way of doing dynamic !!!!
    That's to say without space ??? How can we do ?


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