C1Tab Reference > C1Tab Methods > AttachPageToTab Method |
Attaches a page to a given tab.
[form!]C1Tab.AttachPageToTab Page As Variant, Position As Long
The AddTab method allows you to add tabs to the control at run time. After adding a tab, use the AttachPageToTab method to connect the new tab to a new "page".
The parameters for the AttachPageToTab method are described below:
Page As Variant
Contains a reference to the new "page" control. In Visual Basic, this parameter should contain a reference to a container control. In Visual C++, this parameter should contain a reference to a container control's window. For more details, see the examples below.
Position As Long
Determines which tab the new page should be attached to. This value should be in the range between zero and NumTabs.
Using the AttachPageToTab method in Visual Basic is very easy. The example below shows how you can add a tab to the control and then attach a page to the new tab. The new tab is created at position 3. When the user selects the new tab, the control will display the control elNewPage in its client area. The code assumes that tb is a Tab control and that elNewPage is a control that contains all the controls that make up the new page (tb and elNewPage should be on the same form):
Example Title |
Copy Code
|
---|---|
tb.AddTab "&New Page", 3
tb.AttachPageToTab elNewPage, 3
|
Using the AttachPageToTab method in Visual C++ is a little different. Because VC++ does not provide extender controls with a Container property, the Page parameter should be a window handle instead of a control reference. The code below is the VC++ equivalent of the previous example:
Example Title |
Copy Code
|
---|---|
m_tb.AddTab("&BNew Page", COleVariant(3L), COleVariant(0L, VT_ERROR)); m_tb.AttachPageToTab(COleVariant((long)m_elNewPage.GetHWnd()), 3); |