Share via


Filter Expression Dialog Box Foundation Class

This class creates an advanced filter expression dialog box.

Category

Data Query

Default Catalog

Visual FoxPro Catalog\Foundation Classes\Data Query

Class

_filterexpr

Base Class

Form

Class Library

_table.vcx

Parent Class

_form

Sample

...\Samples\Solution\Ffc\datasort.scx

Remarks

To use, drop the class on a project or, from the Component Gallery Item shortcut menu, select Create Form or Add to Project. When you drop the class on a project, you can choose between adding the class, creating a subclass, or creating a form. When you drop the class on a project or choose Create a new form from the selected class in the shortcut menu, Visual FoxPro displays an Open dialog box so you can specify the name of the form. Visual FoxPro then creates and opens the form in the Form Designer.

_FilterExpr is a modal dialog box that enables you to specify a filter expression, or to construct a filter expression using one of two subsidiary dialog boxes.

The lAdvanced property toggles _FilterExpr between two modes, standard and advanced. In standard mode, the Build expression button uses an instance of the _FilterDialog class to build a simple expression. In advanced mode, the button uses the value in the _GETEXPR system variable.

The cFilter property contains the current contents of the filter expression the user builds. The edit box bound to the cFilter property can contain up to 254 characters.

If _FilterExpr doesn't find a table on which to act, it returns false (.F.) before leaving the Init event; otherwise it restores these settings in its Unload method. When _FilterExpr instantiates, if ALIAS( ) is empty, it looks for an open table in the current data session of the currently selected form or formset.

See Guidelines for Using Visual FoxPro Foundation Classes for more information on using foundation classes.

Properties, Events, Methods

Descriptionbox b

cFilter property

Contains the filter expression processed in the SetupFilter method.

Default: (SPACE(254))

lAdvanced property

This is used to toggle _FilterExpr between two modes, _FilterDialog false (.F) and GETEXPR true (.T.).

Default: .F.

iOldSession property

The old data session.

Default: 0

iOldSelect property

The old work area.

Default: 0

SetFilter method

Sets the value of cFilter. This method is primarily useful when _FilterDialog is called modally to do further work on the expression to be built.

Syntax: SetFilter(tcValue)

Return: cFilter

Arguments: tcValue specifies an expression to use as the filter.cFilter is the filter expression.

SetFilterOnTable method

If the current table allows navigation, this method applies the current filter to the current alias, issues a LOCATE, and then invokes the RefreshLastWindowAfterChange( ) method to get the filter for the next available window in your application.

Syntax: SetFilterOnTable( )

Return: none

Arguments: none

cFilter_Access method

Internal to the class. Removes carriage returns, line feeds, and tabs from the filter expression and replaces these characters with spaces.

See Also

Concepts

Guidelines for Using Visual FoxPro Foundation Classes

Reference

Visual FoxPro Foundation Classes A-Z

Other Resources

Foundation Class Samples