Setting TwwGrid filters in code
I would like to bring up a TwwDBGrid with a text filter in the title menu already set up for the user. I can set up a filter on the dataset that is connected to the grid, but the user cannot see any indication it is there.
Are there any properties or methods taht would let me set up the filter in code?
-
One way would be to model it after our savefilter demo. Just set TitleAttributes.Enabled to true and change the FormShow event to be like the following.
procedure TSaveFilterDemo.FormShow(Sender: TObject);
begin
wwSaveFilter1:= TwwSaveFilter.create(Application);
wwSaveFilter1.Delimiter := '///';
wwSaveFilter1.FilePath := 'SaveFilt.txt';
// Code changes below from original demo
wwdbgrid1.FormGridFilterTypesNeeded;
wwSaveFilter1.wwFilterDialog := //wwFilterDialog1;
TwwFilterDialog(wwdbgrid1.FormGridFilterTypes.FilterDialog);
Width:= (LongInt(Width) * PixelsPerInch) div 96;
Height:= (LongInt(Height) * PixelsPerInch) div 96;
end;
Now you can load/save filters by name
Please sign in to leave a comment.
Comments
1 comment