Filter and Multi-selection

41 views
Skip to first unread message

Thietbi Hanoi

unread,
Feb 16, 2022, 8:35:07 AM2/16/22
to Rosi Delphi Components
Hello,

I am trying your rDBGrid_MS demo by enabling the filter but it does not show up at run time. Also if I make a new rDBGrid_MS and enable both the filter and dgMultiSelect then multi-selection function does not work.

What  am I doing wrong here.

Please kindly advise.

Thank you very much in advance.

Regards,
Minh

Tomas Rosinsky

unread,
Feb 16, 2022, 9:49:20 AM2/16/22
to Rosi Delphi Components
Hello,

thank you for trying my components.
It is quite difficult to advice if you do not provide any code example or information what property you are set exactly.

Anyway, regarding multiselect, if you want to change it in the runtime, you have to set UseMultiSelect property (by default it is set according to dgMultiSelect setting from design time, but in runtime it must be set by UseMultiSelect ).
Regarding filter options, you can set it in runtime by OptionsEx2.Filters.FunnelBtn + OptionsEx2.Filters.TextBar + OptionsEx2.Filters.FilterPanel.

See my DBDemo application which shows how to set it in the runtime.

I hope it helps
Regards
Tomas

 

Dne středa 16. února 2022 v 14:35:07 UTC+1 uživatel hung1...@gmail.com napsal:

Thietbi Hanoi

unread,
Feb 16, 2022, 7:55:20 PM2/16/22
to Rosi Delphi Components
Hello,

The option UseMultiSelect solves the problem. Thank you very much for your great advice.

By the way, I am trying the odd row color function by setting at run time:

    ColorOddRow := clAqua;
    OptionsEx2.Appearance.DrawColoredRow := True;  

however, the effect only appears when scrolling the mouse not like your demo.

Please kindly advise.

Regards,
Minh

Tomas Rosinsky

unread,
Feb 17, 2022, 9:08:05 AM2/17/22
to Rosi Delphi Components
Hello,
I'm glad it helps.

I'm sorry I have no idea why OddRow color is not updated immediatelly as DBGrid.Invalidate is called for update of both properties ColorOddRow +   OptionsEx2.Appearance.DrawColoredRow.

procedure TrDBGrid.SetColorOddRow(Value: TColor);
begin
  FColorOddRow:=Value;
  Invalidate;
end;

procedure TOptionsAppearance.SetDrawColoredRow(Value: boolean);
begin
  FDrawColoredRow:=Value;
  FOwner.Invalidate;
end;

procedure DrawColumnCell:
...
    IsColored:=FOptionsEx2.FAppearance.FDrawColoredRow and (not Highlighted) and (DataLink.DataSet.recno mod 2 = 0) and (Canvas.Brush.Color = Column.Color);
...
    if IsColored then 
      Canvas.Brush.Color:=FColorOddRow;


What DB type are you using?
Can you debug and check if the DrawColumnCell is called after DrawColoredRow set?

Thanks
Tomas 

Dne čtvrtek 17. února 2022 v 1:55:20 UTC+1 uživatel hung1...@gmail.com napsal:

Thietbi Hanoi

unread,
Feb 18, 2022, 4:49:26 AM2/18/22
to Rosi Delphi Components
Hello,

Thank you for your advice.

I am using the MS Access DB with FireDAC.
There is no  DrawColumnCell called anywhere.

The strange thing is that I test with different rDBGrid_MS in different TabSheet (same PageControl) and there is only one grid shows correctly with OddRow color. The setting of that grid is exactly the same with all others.

Maybe it is the IDE bug?

Tomas Rosinsky

unread,
Feb 18, 2022, 5:09:41 AM2/18/22
to Rosi Delphi Components
Nobody else reported similar issue so I think it is not the general issue in the RAD.
Could you please prepare some minimal project showing this issue and send it to me? I will check the reason and try to fix it.
Thank you
Tomas

Dne pátek 18. února 2022 v 10:49:26 UTC+1 uživatel hung1...@gmail.com napsal:

Thietbi Hanoi

unread,
Feb 21, 2022, 3:13:49 AM2/21/22
to Rosi Delphi Components
Hello,

Enclosed is the zipped file with all source code and also the demo data base which is taken from your demonstration package. I also includes the screen capture image showing the Odd Row color for your reference.

Thank you so much in advance for your advice.

Regards,
Minh

OddRowColor.zip

Tomas Rosinsky

unread,
Feb 21, 2022, 4:16:42 AM2/21/22
to Rosi Delphi Components
Hello,
thank you for the demo, it is clear now.

The determination if the row is odd is based on Dataset.RecNo property.  If this property does not work then also Colored Odd row cannot work.
The issue is based inside of FDTable which supports RecNo property only for ckStatic or ckDefault cursor type (see FetchOptions.CursorKind). 
Currently ckAutomatic is used and in this case RecNo returns always same value.

So if you want to use Colored rows then change CursorKind to ckStatic, there is no other solution just now.

Regards
Tomas

Dne pondělí 21. února 2022 v 9:13:49 UTC+1 uživatel hung1...@gmail.com napsal:

Thietbi Hanoi

unread,
Feb 21, 2022, 4:49:41 AM2/21/22
to Rosi Delphi Components
Hello,

Your great advice solves the problem.

I do appreciate your useful information.

Have a nice working week ahead.

Regards,
Minh
Reply all
Reply to author
Forward
0 new messages