Hello
Quote:
when the option "dghIncSearch" is checked ...selecting all occurrences
Searching text for dghIncSearch is not public, so you should use Crack to access protected fields.
Next code take Searching text and select all the rows in the grid which satisfy the search text.
Code:
type
TDBGridEhCrack = class(TDBGridEh);
procedure TForm1.Button1Click(Sender: TObject);
var
SearchText: String;
bm: TBookmark;
s: String;
begin
SearchText := TDBGridEhCrack(DBGridEh1).FInplaceSearchText;
MemTableEh1.DisableControls;
while not MemTableEh1.Eof do
begin
s := MemTableEh1.FieldByName('Continent').AsString;
if (Copy(s, 1, Length(SearchText)) = SearchText) then
begin
DBGridEh1.SelectedRows.AppendBookmark(bm);
bm := MemTableEh1.Bookmark;
end;
MemTableEh1.Next;
end;
MemTableEh1.EnableControls;
end;
Quote:
filtering only the one found in "SearchPanel FilterOnTyping"
When working with SearchPanel in FilterOnTyping mode, the filter already filters data when user types the text.
Why filter them again?
To filter only one current record, you just have to get the key of the current record and generate the text for the Filter property.
Code:
procedure TForm1.Button2Click(Sender: TObject);
var
key: String;
begin
key := MemTableEh1.FieldByName('Name').AsString;
MemTableEh1.Filter := 'Name = ''' + key + '''';
MemTableEh1.Filtered := True;
end;