Components for Delphi and C++ Builder.

Go to Russian forum
Go to EhLib.com
It is currently 26 Sep 2020, 23:40

All times are UTC




Post new topic Reply to topic  [ 11 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: 31 Jan 2020, 12:26 
Offline

Joined: 13 Jul 2019, 19:08
Posts: 45
Hello I would like to know how to do it when the option "dghIncSearch" is checked when searching in a grid, selecting all occurrences and filtering only the one found in "SearchPanel FilterOnTyping"

Thankful.


Top
 Profile  
 
PostPosted: 04 Feb 2020, 16:51 
Offline

Joined: 08 May 2014, 18:06
Posts: 416
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;


Attachments:
sshot-73.png
sshot-73.png [ 12.49 KiB | Viewed 1075 times ]

_________________
Best regards
EhLib Support Team
Top
 Profile  
 
PostPosted: 04 Feb 2020, 19:25 
Offline

Joined: 13 Jul 2019, 19:08
Posts: 45
I don't want to use "SearchPanel" Mode
I want to use "dghIncSearch" and do two things

1º Select all the yellow Records that were found.

2nd Summarize the records as you type something like "FilterOnTyping" but using "dghIncSearch"


Top
 Profile  
 
PostPosted: 04 Feb 2020, 19:49 
Offline

Joined: 13 Jul 2019, 19:08
Posts: 45
I tested the code:

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;


it didn't work and the big problem with this code is that I will have to implement all Grids and Columns for the entire system, I wanted a more generic code, to work automatically for the entire system. I believe you already have the solution as it would be to implement the "SearchPanel" functionality in "dghIncSearch"

In this link below I put a Video for you to better understand what I need.
I used a Trial version of QuantumGrid "DevExpress" that does it automatically, I just needed to activate a property for that.

https://mega.nz/#!c2hXxazb!OqF6qW7C_GZbmGuiDW5R87Ly-Qb1aeL2uDWJ6cBgEPU


Top
 Profile  
 
PostPosted: 07 Feb 2020, 22:29 
Offline

Joined: 08 May 2014, 18:06
Posts: 416
Hello

About dghIncSearch with filtering and highlighting all the data found, it looks reasonable.
But the video is not all clear.

RowSelect mode is set on the Video in the grid, but when typing, the search and highlighting goes only along the second column.

Do you need to be able to adjust by which column the search should be in RowSelect mode, or will it be sufficient to make a mode in all columns?
Or in RowSelect mode always do the first column?
Or do you need some sort of additional property to select a column?

---
I think we can extend the SearchPanel mode and add the SearchPanel.Location = splInplace mode.
When SearchPanel will not be visible, but it will automatically work when typing in a grid cell.

But this can only be added to the next version of the library, but not to the next Build.

_________________
Best regards
EhLib Support Team


Top
 Profile  
 
PostPosted: 08 Feb 2020, 00:37 
Offline

Joined: 13 Jul 2019, 19:08
Posts: 45
This example I sent you from devexpress I just clicked the mouse on the second column and started typing; I never clicked on the first column.
Thus it is necessary that the selection of records is only in the records found only in the second column which is where I am writing.

My problem is that a software competitor presented software with this type of search and now a client of mine wants this type of search.
When you say put this search in the next version I see that it will take time, if you could release it in a builder before I would be very grateful.


Top
 Profile  
 
PostPosted: 10 Feb 2020, 11:31 
Offline

Joined: 24 Aug 2018, 13:15
Posts: 46
Location: Brazil
This would be a very interesting feature, and we would definitely use it too.


Top
 Profile  
 
PostPosted: 19 Feb 2020, 10:32 
Offline

Joined: 13 Jul 2019, 19:08
Posts: 45
hello functionality was created in Version 9.5 Beta
I'm testing it and it was great.


Top
 Profile  
 
PostPosted: 20 Feb 2020, 13:10 
Offline

Joined: 24 Aug 2018, 13:15
Posts: 46
Location: Brazil
Luciano_F wrote:
hello functionality was created in Version 9.5 Beta
I'm testing it and it was great.

Como você conseguiu acesso ao beta?


Top
 Profile  
 
PostPosted: 20 Feb 2020, 13:11 
Offline

Joined: 24 Aug 2018, 13:15
Posts: 46
Location: Brazil
EhLibSupport wrote:
Hello

About dghIncSearch with filtering and highlighting all the data found, it looks reasonable.
But the video is not all clear.

RowSelect mode is set on the Video in the grid, but when typing, the search and highlighting goes only along the second column.

Do you need to be able to adjust by which column the search should be in RowSelect mode, or will it be sufficient to make a mode in all columns?
Or in RowSelect mode always do the first column?
Or do you need some sort of additional property to select a column?

---
I think we can extend the SearchPanel mode and add the SearchPanel.Location = splInplace mode.
When SearchPanel will not be visible, but it will automatically work when typing in a grid cell.

But this can only be added to the next version of the library, but not to the next Build.



When the version 9.5 it will be release?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group