Jump to content


Photo

input as filter


  • Please log in to reply
10 replies to this topic

#1 am2

am2
  • Members
  • 31 posts

Posted 16 July 2008 - 09:37 PM

Hello Boki,

I'm trying to use the input line for filtering through the OnEdit event handler:

...OnEdit(Sender: TObject; ACol,
ARow: Integer; Value: WideString);
var grid: TNextGrid;
s: WideString;
i: Integer;
visible: Boolean;
begin
if ARow>=0 then exit;
grid := (Sender as TNextGrid);
grid.BeginUpdate;
for i := 0 to grid.RowCount - 1 do begin
s := WideUpperCase(Value);
visible := (s = '') or (WidePos(s, WideUpperCase(grid.Cells[0, i])) > 0);
grid.RowVisible[i] := visible;
end;
grid.EndUpdate;
end;

This works almost well, I've got only one problem: when I press a key - the very first time - inside the input line, this code does the filtering but it selects the text inside the inputline too (I gues the RowVisible is responsible for this) - is there any workaround?

#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,289 posts
  • Gender:Male

Posted 16 July 2008 - 10:00 PM

Hello Am,

Can you please send me one small demo for me. It will help a lot.

regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#3 am2

am2
  • Members
  • 31 posts

Posted 17 July 2008 - 12:45 AM

Hello Boki,

It seems that it happens only when there are more elements in the grid that can be displayed. I'm sending you a test project. Enter five elements into the grid through the input line and then add the sixth, seventh and you'll see the problem.

Best regards

Attached Files

  • Attached File  test.zip   346.58KB   6 downloads


#4 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,289 posts
  • Gender:Male

Posted 17 July 2008 - 02:07 PM

Hello Am2,

I have fix it. Do you want to I send you component again.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#5 am2

am2
  • Members
  • 31 posts

Posted 17 July 2008 - 02:45 PM

QUOTE (Boki (Berg) @ Jul 17 2008, 03:07 PM) <{POST_SNAPBACK}>
Hello Am2,

I have fix it. Do you want to I send you component again.

Best regards


Hello Boki

Yes, please. Thank you!

#6 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,289 posts
  • Gender:Male

Posted 17 July 2008 - 04:02 PM

Hello Am2,

Please look for fixed version in attachment.

Best regards

Attached Files


boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#7 am2

am2
  • Members
  • 31 posts

Posted 17 July 2008 - 04:39 PM

QUOTE (Boki (Berg) @ Jul 17 2008, 05:02 PM) <{POST_SNAPBACK}>
Hello Am2,

Please look for fixed version in attachment.

Best regards


Hello Boki,

It's working, but there is now another issue: a square appears at the end of the unicode text. I could not reproduce this using the test project, so I'm sending you a picture as a demonstration. I'll try to reproduce this using the test project.

Best regards

Attached Files



#8 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,289 posts
  • Gender:Male

Posted 17 July 2008 - 08:34 PM

Hello Am2,

Can you please send me this small project again since I can't detect this problem with my testings.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#9 am2

am2
  • Members
  • 31 posts

Posted 17 July 2008 - 09:35 PM

Hello Boki,

I couldn't reproduce the symptom with the test project, but I can send you my program if you wish. It needs some additional packages and components: SQLite.dll, Aducom's ASQLite package, LMD SE package, Delphi fundamentals and of course tnt and nextgrid. Just let me know if you are willing to install these packages.

I'm saving new elements into the SQLite db inside the OnInputAccept event handler and it seems to me that the square appears somewhere during that operation. I must convert WideString to UTF8 for SQLite.

Best regards

#10 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,289 posts
  • Gender:Male

Posted 17 July 2008 - 09:41 PM

Hello Am2,

Maybe is better that you use InputLine for filtering only, but other field for adding new items smile.gif

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#11 am2

am2
  • Members
  • 31 posts

Posted 18 July 2008 - 01:05 AM

Hello Boki,

I've found the cause of the trouble: it wasn't NextGrid but one of Aducom's ASQLite component.

Best regards




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users