method Column.ShowFilter ([Options as Variant])
Shows the column's filter window.

 TypeDescription 
   Options as Variant A string expression that indicates the position ( in screen coordinates ) and the size ( in pixels ) where the drop down filter window is shown. The Options parameter is composed like follows: 
  • the first parameter indicates the X coordinate in screen coordinate, -1 if the current cursor position is used, or empty if the coordinate is ignored
  • the second parameter indicates the Y coordinate in screen coordinate, -1 if the current cursor position is used, or empty if the coordinate is ignored
  • the third parameter indicates the width in pixels of the drop down window, or empty if the width is ignored
  • the forth parameter indicates the height in pixels of the drop down window, or empty if the height is ignored

By default, the drop down filter window is shown at its default position bellow the column's header.

 
Use the ShowFilter method to show the column's drop down filter programmatically. By default, the drop down filter window is shown only if the user clicks the filter button in the column's header, if the DisplayFilterButton property is True. The drop down filter window if the user selects a predefined filter, or enters a pattern to match. If the Options parameter is missing, or all parameters inside the Options are missing, the size of the drop down filter window is automatcially computed based on the FilterBarDropDownWidth property and FilterBarDropDownHeight property. Use the ColumnFromPoint property to get the index of the column from the point.

For instance, the following VB sample displays the column's drop down filter window when the user right clicks the control:

Private Sub Grid1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If (Button = 2) Then
        With Grid1.Columns
            With .Item(Grid1.ColumnFromPoint(-1, 0))
                .ShowFilter "-1,-1,200,200"
            End With
        End With
    End If
End Sub

The following VB.NET sample displays the column's drop down filter window when the user right clicks the control:

Private Sub AxGrid1_MouseUpEvent(ByVal sender As Object, ByVal e As AxEXGRIDLib._IGridEvents_MouseUpEvent) Handles AxGrid1.MouseUpEvent
    If (e.button = 2) Then
        With AxGrid1.Columns
            With .Item(AxGrid1.get_ColumnFromPoint(-1, 0))
                .ShowFilter("-1,-1,200,200")
            End With
        End With
    End If
End Sub

The following C# sample displays the column's drop down filter window when the user right clicks the control:

private void axGrid1_MouseUpEvent(object sender, AxEXGRIDLib._IGridEvents_MouseUpEvent e)
{
    if (e.button == 2)
    {
        EXGRIDLib.Column c = axGrid1.Columns[axGrid1.get_ColumnFromPoint(-1, 0)];
        c.ShowFilter("-1,-1,200,200");
    }
}

The following C++ sample displays the column's drop down filter window when the user right clicks the control:

void OnMouseUpGrid1(short Button, short Shift, long X, long Y) 
{
	m_grid.GetColumns().GetItem( COleVariant( m_grid.GetColumnFromPoint( -1, 0 ) ) ).ShowFilter( COleVariant( "-1,-1,200,200" ) );
}

The following VFP sample displays the column's drop down filter window when the user right clicks the control:

*** ActiveX Control Event ***
LPARAMETERS button, shift, x, y

if ( button = 2 ) then
	With thisform.Grid1.Columns
	    With .Item(thisform.Grid1.ColumnFromPoint(-1, 0))
	        .ShowFilter("-1,-1,200,200")
	    EndWith
	EndWith
endif


Send comments on this topic.
1999-2017 Exontrol.COM, Software. All rights reserved.