本文整理汇总了C++中TStringList::IndexOfObject方法的典型用法代码示例。如果您正苦于以下问题:C++ TStringList::IndexOfObject方法的具体用法?C++ TStringList::IndexOfObject怎么用?C++ TStringList::IndexOfObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TStringList
的用法示例。
在下文中一共展示了TStringList::IndexOfObject方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BookmarkMove
//---------------------------------------------------------------------------
void __fastcall TLocationProfilesDialog::BookmarkMove(TObject * Sender,
TTreeNode * Source, TTreeNode * Dest)
{
TBookmarkList * BookmarkList = GetBookmarkList(Sender);
TTreeView * ProfilesView = GetProfilesView(Sender);
TStringList * Folders = GetFolders(Sender);
assert(Source && Source->Data);
TBookmark * Bookmark = (TBookmark *)Source->Data;
TTreeNode * PrevFolderNode = Source->Parent;
if (!Dest || !Dest->Data)
{
Bookmark->Node = Dest ? Dest->Text : UnicodeString();
BookmarkList->MoveTo(BookmarkList->Bookmarks[BookmarkList->Count - 1],
Bookmark, false);
ProfilesView->Selected->MoveTo(Dest, naAddChild);
}
else
{
TBookmark * DestBookmark = (TBookmark *)Dest->Data;
Bookmark->Node = DestBookmark->Node;
BookmarkList->MoveTo(DestBookmark, Bookmark,
Source->AbsoluteIndex > Dest->AbsoluteIndex);
if (Source->AbsoluteIndex > Dest->AbsoluteIndex)
{
Source->MoveTo(Dest, naInsert);
}
else if (Dest->getNextSibling() != NULL)
{
Source->MoveTo(Dest->getNextSibling(), naInsert);
}
else
{
Source->MoveTo(Dest, naAdd);
}
}
if (PrevFolderNode && !PrevFolderNode->Count)
{
assert(Folders->IndexOfObject(PrevFolderNode) >= 0);
Folders->Delete(Folders->IndexOfObject(PrevFolderNode));
PrevFolderNode->Delete();
}
Source->MakeVisible();
UpdateControls();
}
示例2: RemoveBookmark
//---------------------------------------------------------------------------
void __fastcall TLocationProfilesDialog::RemoveBookmark(TObject * Sender)
{
TBookmarkList * BookmarkList = GetBookmarkList(Sender);
TTreeView * ProfilesView = GetProfilesView(Sender);
TStringList * Folders = GetFolders(Sender);
assert(ProfilesView->Selected);
TTreeNode * Node = ProfilesView->Selected;
if (Node->Data)
{
BookmarkList->Delete((TBookmark *)Node->Data);
TTreeNode * ParentNode = Node->Parent;
Node->Delete();
if (ParentNode && !ParentNode->Count)
{
assert(Folders->IndexOfObject(ParentNode) >= 0);
Folders->Delete(Folders->IndexOfObject(ParentNode));
ParentNode->Delete();
}
}
else
{
UnicodeString Message = MainInstructions(LoadStr(DELETE_BOOKMARK_FOLDER));
if (MessageDialog(Message, qtConfirmation,
qaYes | qaNo, HELP_LOCATION_PROFILE_DELETE) == qaYes)
{
assert(Node->Count);
for (int i = 0; i < Node->Count; i++)
{
BookmarkList->Delete((TBookmark *)Node->Item[i]->Data);
}
assert(Folders->IndexOfObject(Node) >= 0);
Folders->Delete(Folders->IndexOfObject(Node));
Node->Delete();
}
}
UpdateControls();
}