Skip to main content Skip to footer

How to Programmatically Set Focus to the Filter Bar of C1TrueDBGrid on a Specific Column

How to Programmatically Set the Focus of the Filter Bar for the C1TrueDBGrid on a Specific Column

Let's say a user clicked a button to open a form that contains a C1TrueDBGrid, and wants to filter the grid instantly without navigating to the filter bar using their mouse - how might we be able to achieve the desired functionality? Follow the steps below.

To programmatically set the focus on the FilterBar cell of a specific column, you can first set the Col property of the C1TrueDBGrid to the required column.

//select the required column
c1TrueDBGrid1.Col = 2;

Then, you can set the FilterActive property of the C1TrueDBGrid to "True".

//move the focus on Filter Bar
c1TrueDBGrid1.FilterActive = true;

After that, you can set the EditActive property to true to start the editing of the FilterBar cell.

//Start the editing
c1TrueDBGrid1.EditActive = true;

Also, be sure to set the FilterBar to being visible in the main Form() function:

c1TrueDBGrid1.FilterBar = true;

Hunter Haaf