Hide

SftTree/OCX 7.5 - ActiveX Tree Control

Display
Print

FindCellText Method, SftTreeItems Object

Searches items for a string.

Syntax

VB.NETFoundIndex = object.FindCellText(ByVal ItemIndex As Integer, ByVal ColIndex As Short, ByVal SearchString As String) As Integer
VBFoundIndex = object.FindCellText(ByVal ItemIndex As Long, ByVal ColIndex As Integer, ByVal SearchString As String) As Long
C#.NETint FoundIndex = object.FindCellText(int ItemIndex, short ColIndex, string SearchString);
VC++long FoundIndex = object->FindCellText(long ItemIndex, short ColIndex, _bstr_t SearchString);
CHRESULT object->raw_FindCellText(long ItemIndex, short ColIndex, BSTR SearchString, long* FoundIndex);

object

A SftTreeItems object.

ItemIndex

The zero-based index of the item where the search begins (including ItemIndex).

ColIndex

The zero-based column number to be searched.

SearchString

The text to be searched.

FoundIndex

Returns the zero-based index of the item, where the specified SearchString is found. -1 is returned if no item is found matching the specified SearchString.

Comments

The FindCellText method searches items for a string.

The string described by SearchString is compared to the Cell.Text property of all items and columns involved in the search. The search starts at the item described by ItemIndex and is restricted to the column specified by ColIndex. If an item with a matching Cell.Text property is found, its zero-based index is returned, otherwise -1 is returned.

Only one column can be searched at a time. Items.FindCell can be used to search multiple columns and with additional features not available to FindCellText.

The comparison of SearchString and the Cell.Text property is not case sensitive. If the Cell.Text property starts with the string in SearchString, it is considered a match. To find an exact match for SearchString use the Items.FindCellTextExact method.

SearchStringCell.Text PropertyMatchComment
ABCabcYesSame string, case is ignored
abcabc123YesProperty starts with SearchString
abcThisabcNoProperty doesn't start with SearchString
abcabNoProperty doesn't contain the complete SearchString

Examples

C++

/////////////////////////////////////////////////////////////////////////////
// CListFontDlg message handlers

void CListFontDlg::AddFont(LPCTSTR lpszFontName, LPLOGFONT lplf)
{
    _bstr_t FontName(lpszFontName);

    if (m_vTree->Items->Count > 0 && m_vTree->Items->FindCellText(0, 0, FontName) >= 0)
        return; // already added

    FONTDESC fd;
    memset(&fd, 0, sizeof(fd));
    fd.lpstrName = FontName;
    fd.cySize.int64 = 10 * 10000L; // 10pt font
    fd.sWeight = FW_NORMAL;
    IFontDispPtr pFontDisp;

See Also SftTreeItems Object | Object Hierarchy


Last Updated 08/13/2020 - (email)
© 2024 Softel vdm, Inc.


Spring Break!

Our offices will be closed this week (March 18 through March 22).

We'll be back March 24 to address any pending sales and support issues.