Click to See Complete Forum and Search --> : ctabCtrl & multiline


April 9th, 1999, 09:33 AM
hello,

if you have a solution to my problem, my email :
dao2@col.bsf.alcatel.fr

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

Mallik Bulusu
April 9th, 1999, 03:47 PM
//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);
}

April 12th, 1999, 02:54 AM
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 ?