2012-11-12 74 views

回答

3

由於雷米勒博說,問題是OnDataFind沒有實現,但你應該實現它這樣的:

procedure TForm1.ListViewDataFind(Sender: TObject; Find: TItemFind; const FindString: string; 
    const FindPosition: TPoint; FindData: Pointer; StartIndex: Integer; Direction: TSearchDirection; 
    Wrap: Boolean; var Index: Integer); 
begin 
    // Here we must find currently selected element 
    if Assigned((Sender as TListView).Selected) then 
    Index := (Sender as TListView).Selected.Index; 
end; 
+0

謝謝,這是擺脫嘟嘟聲。是否可以在這裏尋求其他相關的東西,或者我現在接受並提出一個新的問題? (如何檢索找到的數據的項目索引)。我不確定FindData是否真的在這裏工作,因爲它觸發任何鍵(我在KeyPress上調用FindCaption) – hikari

+0

您應該接受這個答案。 –

2

控件可能試圖執行列表數據的搜索,以查找與您正在輸入的文本相匹配的項目。您是否實施了OnDataFind活動?

+0

我現在,但蜂鳴聲仍然存在。另外,在FindData觸發器之後,Index似乎總是-1? (即使它找到了某種東西)。 – hikari

相關問題