共用方式為


Filter Dialog Box Foundation Class

Category Data Query
Default Catalog Visual FoxPro Catalog\Foundation Classes\Data Query
Class _filterdialog
Base Class Form
Class Library _table.vcx
Parent Class _form
Sample ...\Samples\Solution\Ffc\datasort.scx

Remarks

This class is a dialog box that uses an existing filter object to allow you to filter data in a particular field.

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. Then Visual FoxPro creates and opens the form in the Form Designer.

_FilterDialog enables you to use Visual FoxPro expressions to build a complex filter using booleans, nested conditions, and so on, limited to the fields available in currently-open tables. It automatically provides delimiters for various field types. It suggests which expressions might be optimizable by checking available tags on the current table. The field list places "*" in front of field names that have usable index tags.

Like _FilterExpr, _FilterDialog needs at least one open table on which it can set a filter. Unlike _FilterExpr, _FilterDialog is not necessarily modal, however it is modal when _FilterExpr calls it. FilterDialog determines the current table in the Init event. FilterDialog never changes data sessions.

When called by _FilterExpr, _FilterDialog determines what filter the user has already specified in the _FilterExpr edit box and displays that expression as its initial set of conditions. When _FilterDialog is called directly, it checks the current alias for a filter, using SET("FILTER"), and shows any current filter as its initial conditions.

The _FilterDialog SetUpFilter( ) method uses the conditions listed in the dialog box and creates a filter expression, then applies the NORMALIZE( ) function to the expression. The result is stored in the cFilter property. When you click OK, SetupFilter( ) runs. _FilterDialog calls the _FilterExpr.SetFilter method if it is called by an instance of _FilterExpr; otherwise it uses _table to determine if navigation is allowed, sets the filter directly, and refreshes the display if the filter is set.

_FilterDialog is a standalone object and does not require the existence of _FilterExpr to build a filter. However, when called by _FilterExpr, the two dialog boxes work together to build a filter, by specifying an expression in _FilterExpr and by making choices in _FilterDialog. For more information on the Filter Expression class, see _Filter Expression.

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

Properties, Events, Methods Description
cFilter property Contains the filter expression processed in the SetupFilter method.
Default: ""
SetupFilter method This method takes the conditions listed in the dialog box and creates them into a filter expression, then applies the NORMALIZE( ) function to the expression.
Syntax: SetupFilter(tcValue)
Return:cFilter
Arguments:
tcValue specifies an expression to use as the filter.
cFilter is the value contained in the cFilter property.
cOldexact property Internal to the class.
iBact property Internal to the class.
iQptr property Internal to the class.
iQuerymax property Internal to the class.
iSelect property Internal to the class.
oCaller property Internal to the class.
aDBFs[1,0] property Internal to the class.
aTags[1,0] property Internal to the class.
aQuery[1,0] property Internal to the class.
aFLDs[1,0] property Internal to the class.
SetAction method Internal to the class.
QReset method Internal to the class.
QSet method Internal to the class.
FSet method Internal to the class.
NoBrack method Internal to the class.
Brackets method Internal to the class.
SetTags method Internal to the class.
OnTag method Internal to the class.
NoTag method Internal to the class.
EditQuery method Internal to the class.
SetRowsources method Internal to the class.
SetInitialQueryParts method Internal to the class.

See Also

Guidelines for Using Visual FoxPro Foundation Classes | Visual FoxPro Foundation Classes A-Z | Visual FoxPro Foundation Classes | _Filter Expression