SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftMask/OCX 7.0 - Masked Edit Control
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftPrintPreview/DLL 2.0 - Print Preview Control (discontinued)
SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftDirectory 3.5 - File/Folder Control (discontinued)
SftMask/OCX 7.0 - Masked Edit Control
SftOptions 1.0 - Registry/INI Control (discontinued)
SftPrintPreview/OCX 1.0 - Print Preview Control (discontinued)
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftTabs/NET 6.0 - Tab Control (discontinued)
SftTree/NET 2.0 - Tree Control
Positions the splitter bar optimally.
VB.NET | object.MakeOptimal() |
VB | object.MakeOptimal |
C#.NET | void object.MakeOptimal(); |
VC++ | HRESULT object->MakeOptimal(); |
C | HRESULT object->raw_MakeOptimal(); |
object
A SftTreeSplitter object.
The MakeOptimal method positions the splitter bar optimally, so the left pane can display as much data as possible without a horizontal scroll bar.
MakeOptimal is only available for a split tree control (see Splitter.Visible).
Before using MakeOptimal, the best horizontal extent for the panes must be set using the Items.HorizontalExtent property or the Items.RecalcHorizontalExtent method. Once set, MakeOptimal can then be used to position the splitter bar optimally, so the left pane can display as much data as possible without a horizontal scroll bar.
MakeOptimal uses the current width of the tree control window to determine the allowable position of the splitter bar. If the tree control window is too small, the splitter bar may not be optimally set. This is particularly noticeable if the tree control window is resized after MakeOptimal is used.
The coordinates of the splitter bar can be retrieved using the Splitter.GetPosition method.
The Splitter.Width property is used to change the width of the splitter bar.
AddMessage(2, "anyone@acompany.com", "Re: You're fired", "10/11/05", 82, False) AddMessage(1, "me@mycompany.com", "You're hired", "10/01/05", 4, False) AddMessage(1, "anyone@acompany.com", "Re: You're hired", "10/11/05", 6, False) ItemIndex = AxSftTree1.Items.ItemIndex(m_SavedFolder) AxSftTree1.get_Item(ItemIndex).Collapse(False) m_DeletedFolder = AddFolder("Deleted", "Deleted messages", 0) AxSftTree1.ColumnsObj.MakeOptimal() AxSftTree1.Items.RecalcHorizontalExtent() AxSftTree1.Splitter.MakeOptimal() ' allow sorting AxSftTree1.Headers.SortIndicators = SftTreeHeaderSortIndicatorsConstants.headerSortIndicatorsSftTreeAuto AxSftTree1.Items.Current = 0 AxSftTree1_CaretChange(Me, New _DSftTreeEvents_CaretChangeEvent(0)) End Sub
AddMessage 1, "me@mycompany.com", "You're fired", "10/08/05", 2, False AddMessage 2, "anyone@acompany.com", "Re: You're fired", "10/11/05", 82, False AddMessage 1, "me@mycompany.com", "You're hired", "10/01/05", 4, False AddMessage 1, "anyone@acompany.com", "Re: You're hired", "10/11/05", 6, False .Item(.Items.ItemIndex(SavedFolder)).Collapse False DeletedFolder = AddFolder("Deleted", "Deleted messages", 0) .ColumnsObj.MakeOptimal .Items.RecalcHorizontalExtent .Splitter.MakeOptimal ' allow sorting .Headers.SortIndicators = headerSortIndicatorsSftTreeAuto .Items.Current = 0 SftTree1_CaretChange 0 ' to update column headers End With End Sub
AddMessage(2, "anyone@acompany.com", "Re: You're fired", "10/11/05", 82, false); AddMessage(1, "me@mycompany.com", "You're hired", "10/01/05", 4, false); AddMessage(1, "anyone@acompany.com", "Re: You're hired", "10/11/05", 6, false); ItemIndex = axSftTree1.Items.get_ItemIndex(m_SavedFolder); axSftTree1.get_Item(ItemIndex).Collapse(false); m_DeletedFolder = AddFolder("Deleted", "Deleted messages", 0); axSftTree1.ColumnsObj.MakeOptimal(); axSftTree1.Items.RecalcHorizontalExtent(); axSftTree1.Splitter.MakeOptimal(); // allow sorting axSftTree1.Headers.SortIndicators = SftTreeHeaderSortIndicatorsConstants.headerSortIndicatorsSftTreeAuto; axSftTree1.Items.Current = 0; axSftTree1_CaretChange(this, new _DSftTreeEvents_CaretChangeEvent(0)); }
AddMessage(1, _T("me@mycompany.com"), _T("You're fired"), _T("10/08/05"), 2, FALSE); AddMessage(2, _T("anyone@acompany.com"), _T("Re: You're fired"), _T("10/11/05"), 82, FALSE); AddMessage(1, _T("me@mycompany.com"), _T("You're hired"), _T("10/01/05"), 4, FALSE); AddMessage(1, _T("anyone@acompany.com"), _T("Re: You're hired"), _T("10/11/05"), 6, FALSE); m_vTree->Item[m_vTree->Items->ItemIndex[m_SavedFolder]]->Collapse(VARIANT_FALSE); m_DeletedFolder = AddFolder(_T("Deleted"), _T("Deleted messages"), 0); m_vTree->ColumnsObj->MakeOptimal(); m_vTree->Items->RecalcHorizontalExtent(); m_vTree->Splitter->MakeOptimal(); // allow sorting m_vTree->Headers->SortIndicators = headerSortIndicatorsSftTreeAuto; m_vTree->Items->Current = 0; OnCaretChangeSftTree1(0); // to update column headers return TRUE; // return TRUE unless you set the focus to a control
See Also SftTreeSplitter Object | Object Hierarchy