ComboBox Class Properties and Methods

Properties

The following table lists the class properties. The properties listed include the standard Visual FoxPro class properties that the VPM Enterprise class uses and the VPM Enterprise custom properties. Where appropriate, the comments column of the table describes a property and provides suggestions for its use.

Property & Initial Value

Comments

Standard Properties Used:

 

ColorScheme = 1

 

ColumnLines = .F.

 

FontBold = .F.

 

FontName = “Courier New”

 

FontSize = 9

 

Height = 22

 

Margin = 2

 

Name = “combobox_”

 

Width = 150

 

Custom Properties:

 

aPicklistFilterVariables[1,2]

An array that can be filled with the definition of filter variables that will be set before the Picklist cursor is created, causing records to be excluded from the cursor. The array is a two-dimensional array that defines the variables used in the WHERE clause of a view or cursoradapter’s SELECT statement. Prior to the cursor being created the variables listed in the array are defined using the name from column 1 and the value from column 2.

aValidFilterVariables[1,2]

An array that can be filled with the definition of filter variables that will be set before the validation cursor is created, causing records to be excluded from the cursor. The array is a two-dimensional array that defines the variables used in the WHERE clause of a view or cursoradapter’s SELECT statement. Prior to the cursor being created the variables listed in the array are defined using the name from column 1 and the value from column 2.

cAlias = “”

For data-bound controls whose ControlSource property does not include the cursor alias, the developer should fill-in this property with the alias of field’s cursor. It is used for various purposes, including being passed to the validation routine.

cCSControlID = “”

The two-character ID used to identify the control when setting up Control Security.

cCursorAlias = “”

If the combobox uses the SQL RowSourceType method, this property will contain the alias of the SQL cursor.

cEnabledExpression = “”

Can be filled with an expression that is evaluated by the form’s EnableDisableToolbarControls method as each ISA record is displayed. The result of the evaluation (.T. or .F.) is placed in the form/toolbar control’s Enabled property.

cEnabledOnlyWhenNew Expression = “”

Can be filled with an expression that is evaluated by the form’s EnableDisableControls method when the record that is bound to the control is new. The result of the evaluation (.T. or .F.) is placed in the control’s Enabled property.

cFieldSecurityID = “”

Contains the Field Security ID that is automatically filled-in from the data dictionary in the Init method. Is passed to the When routine to implement view-only Field Security.

cFindForm_SQL = “find_sql”

Contains the name of the SQL Find form or form class. The SQL Find form is brought up prior to the Picklist form being brought up to allow the user to filter the records that appear in the Picklist cursor.

cFindForm_SQL_AltCaptions = “”

When the SQL Find form is used, specifies captions to be used on the Find form (semi-colon delimited list) instead of captions from the data dictionary. The captions should be entered into the property in the order in which the associated parameters (Find<field name> variables) will be displayed on the Find form. Captions can be entered selectively, meaning that only those captions that should be different than the captions that would be used by default from the data dictionary need to be specified.

cFindForm_SQL_ClassLibrary = “progen”

Contains the name of the class library that contains the SQL Find form class if cFindForm_SQL contains the name of a form class.

cFKUpdate_FKFields = “”

Contains a comma-delimited list of fields that will be replaced with lookup cursor PK values from the new record that is created through the lookup cursor editing form.

cFKUpdate_Form = “”

Contains the name of the lookup cursor editing form.

cFKUpdate_PKFields = “”

Contains a comma-delimited list of PK fields in the new lookup cursor record whose values will be used to replace FK fields in the current record.

cLookupAlias = “”

If the lLookupDescription property is set to .T., this property can be used to identify the alias of the lookup cursor. If blank, the lookup cursor will be found by searching the cursors in the DE.

cLookupDDDName = “”

Contains the name of the database or cursoradapter library that contains the table, view, or cursoradapter specified in the cLookupDDTVName property.

cLookupDDTVName = “”

The lookup cursor that is used to display the lookup description does not have to be opened through the DE. The Init method of the control will open the lookup cursor if this property contains the name of the table, view, or cursoradapter. If a table, the extension must be included. Also, the cLookupAlias property must contain the alias that will be assigned to the cursor.

cLookupFKExpression = “”

Contains the expression used to determine the value used when finding the lookup cursor record.

cName_DDD = “”

Identifies the DD database/CA library name when different from the database/CA library that can be derived from the alias specified in the ControlSource.

cName_DDF = “”

Identifies the DD field name when different from the field name specified in the ControlSource.

cName_DDTV = “”

Identifies the DD table/view/CA name when different from the table/view/CA alias specified in the ControlSource.

cPicklistFilterExpression = “”

Can contain a filter expression to be applied to the Picklist cursor.

cPicklistID = “”

Allows for the specification of the Picklist definition to be used when the Picklist form is brought up. If empty, the default Picklist definition will be used. Otherwise, a Picklist ID can be entered that matches the desired Picklist ID as entered in the Picklist Builder.

cRightClick_Menu = “S”+_SCREEN.oApp.cCurPre+ ”FCBO.MPR”

The name of the right-click shortcut menu to be run.

cValidFilterExpression = “”

Can contain a filter expression to be applied to the validation cursor that is used to validate the control’s value.

cValidRulesID = “”

Passed on to field validation business rules methods and DD validation code snippets so that validation logic can be conditional if necessary, based on this value.

cWhenExpression = “”

Contains the When expression that is automatically filled-in from the data dictionary by the Init event. Is passed to the When routine.

i_cUse_ID = “”

A two-character ID used by the multilingual functionality to provide for the unique translation of a control’s properties.

i_lOverrideControlSource = .F.

Used by the multilingual functionality to bypass the translation of the ControlSource property value.

i_lOverrideDragIcon = .F.

Used by the multilingual functionality to bypass the translation of the DragIcon property value.

i_lOverrideFont = .F.

Used by the multilingual functionality to bypass the translation of the Font property value.

i_lOverrideInputMask = .F.

Used by the multilingual functionality to bypass the translation of the InputMask property value.

i_lOverrideRowSource = .F.

Used by the multilingual functionality to bypass the translation of the RowSource property value.

i_lOverrideStatusBarText = .F.

Used by the multilingual functionality to bypass the translation of the StatusBarText property value.

i_lOverrideToolTipText = .F.

Used by the multilingual functionality to bypass the translation of the ToolTipText property value.

i_lTranslate_SetDescription = .T.

Used by the multilingual functionality to determine whether or not the Set descriptions are translated.

KeyPressResetValue = “”

See the comments for lKeyPressReset property.

lEnableDisableControl = .T.

If .T., means that this control participates in the enabling/disabling of controls by the edit mode.

lEnabledOnlyWhenNew = .F.

If .T., means that the control is only enabled when the record is new, and is disabled after the record has been saved.

lFindForm_SQL = .F.

The Picklist cursor specified for a FK in the Picklist Builder can use the Find<field name> filter variables to limit the records that will populate the Picklist cursor. This property, when set to .T., will cause the SQL Find form to be run before the Picklist form is run. The SQL Find form accepts filter variable values and repopulates the Picklist cursor. The control also has the properties cFindForm_SQL, cFindForm_SQL_AltCaptions, and lFindForm_SQL_NoEntriesOK that provide the same control over the SQL Find form that properties of the same names at the form level provide over the SQL Find form that is brought up through the Find button on the toolbar.

lFindForm_SQL_NoEntriesOK = .F.

When the SQL Find form is used with this control, specifies whether the user can leave all filter variables empty. Doing so causes the Picklist cursor to contain all records.

lFirstRequery = .T.

If the combobox uses the SQL RowSourceType method, this property is used to make sure that certain code in the Requery method is run only once.

lFKUpdateOneAdd = .F.

If .T. and the Add New option on the right-click menu or the Add button on the F2 Picklist form is clicked, the Picklist cursor editing form is automatically closed after the initial new record is saved or cancelled.

lFKUpdateRequeryView = .T.

Set to .T. when the Add New or Edit option on the right-click menu or the Add or Edit button on the F2 Picklist form is clicked. This causes the requery/refresh of the FK field’s lookup cursor upon form reactivation.

lGridOverrideCaption = .F.

If .T., the header caption of the column containing this control will not be overwritten with the grid label (short description) stored in the DD.

lKeyPressReset = .T.

If .T. (the default), and the user presses the reset key or key combination (the Delete key by default, as defined by the properties nKeyPressReset_KeyCode and nKeyPressReset_ShiftAltCtrl), the value in the KeyPressResetValue property is placed in the Value property of this control. This allows for the resetting of the field value when the field value is not edited directly, like when a description from a lookup cursor is displayed instead of the field value.

lLastWidthZero = .F.

If set to .T. in the Init method, the last field in the cursor is the PK field that was added to the fields list of the SELECT command that was entered into the combobox’s RowSource property in the Init method and should not be shown in the dropdown list.

lLookupDescription = .T.

If .T., the control will display a description from the lookup cursor instead of the value in the field.

lOverrideFieldSecurity = .F.

If .T., the Field Security functionality will be disabled for this control because the cFieldSecurityID property is not filled in with the ID value stored in the DD.

lOverrideFormat = .F.

If .T., the Format property value of this control will not be overwritten with the Format stored in the DD.

lOverrideInputMask = .F.

If .T., the InputMask property value of this control will not be overwritten with the Input Mask stored in the DD.

lOverrideStatusBarText = .F.

If .T., the StatusBarText property value of this control will not be overwritten with the Status Bar Text (Message) stored in the DD.

lOverrideToolTipText = .F.

If .T., the ToolTipText property value of this control will not be overwritten with the ToolTip Text stored in the DD.

lOverrideWhen = .F.

If .T., the cWhenExpression property value of this control will not be overwritten with the When expression stored in the DD.

lOverrideWidth = .F.

If .T., the width of this control will not be modified at runtime by code in the Init method. Currently, a combobox is only resized when displaying Set Integrity information.

lPicklist = .T.

If .T., will enable the F2 Picklist when the field that is bound to this control is validated using Set or Referential type Integrity.

lSelectByMouse = .F.

Used internally to provide the functionality whereby if the SelectOnEntry property is set to .T. and this control is clicked on, the text in the control is selected.

lShowSetValueAndDescription = .F.

If .T., both the field value and lookup description will be displayed in the dropdown list. If .F., the display of just the field value or just the lookup description is determined by the setting of the lLookupDescription property.

lSQLMethod = .F.

If the combobox uses the SQL RowSourceType method, this property will be set to .T..

nIncrementalSearchInterval = 0

If a value greater than zero, becomes the _INCSEEK value while this control has focus.

nKeyPressReset_KeyCode = 7

Along with the nKeyPressReset_ShiftAltCtrl property value defines the Reset key. The key that when pressed causes the Value property value to be reset. See the INKEY() topic in the VFP help file for a definition of valid values for this property and the nKeyPressReset_ShiftAltCtrl property. Also see the comments for lKeyPressReset property for more information.

nKeyPressReset_ShiftAltCtrl = 0

See the comments for nKeyPressReset_KeyCode property.

nSave_INCSEEK = 0

When nIncrementalSearchInterval is used, nSave_INCSEEK is used to save the _INCSEEK value so that it can be reset when this control loses focus.

oActiveForm = .F.

Since controls can be placed on both forms and toolbars, and since calls are made in the methods of this control to methods of the active form, the oActiveForm property will contain the object reference of the active form.

oDDFRecord = .F.

When data is retrieved from an SDATADDF record for this control, the record is saved as an object to this property.

oDDTVRecord = .F.

When data is retrieved from an SDATADDTV record for this control, the record is saved as an object to this property.

Methods

The following table lists the class methods. The methods listed include the standard Visual FoxPro class methods that the VPM Enterprise class uses and the VPM Enterprise custom methods. Where appropriate, the Comments column of the table describes a method and provides suggestions for its use.

Method

Comments

Standard Methods Used:

 

Destroy

Releases the object references stored in the oActiveForm, oDDFRecord, and oDDTVRecord properties.

DropDown

If displaying a lookup cursor description for a FK field, runs the Requery method to make sure the latest entries will be displayed in the list.

GotFocus

Sets the value of the _INCSEEK system variable to the value in the nIncrementalSearchInterval property.

Init

Identifies the form associated with this control and places the object reference of the form into the oActiveForm property.

Calls the SetControlProperties method of the active form that fills-in generic control properties.

Finds the SDATADDF and SDATADDTV records for this control and fills-in properties specific to this control, including the oDDFRecord and oDDTVRecord properties.

Adjusts the width of the control based on the font settings.

Creates the cursor, if necessary, used to populate the dropdown list.

KeyPress

Prevents the entering of a backspace from moving the focus off the control.

Checks to see if the user has pressed the reset key or key combination. If so, changes the value in the control’s Value property to the reset value. See the comments for the lKeyPressReset property for more information.

LostFocus

Resets the value of the _INCSEEK system variable.

MouseUp

If the SelectOnEntry property is set to .T., selects the text in the control.

Refresh

Runs the Requery method to make sure the latest entries will be displayed in the list.

Requery

The first time this method is run when the RowSourceType property is set to 3 (SQL), resets the ColumnWidths property. This is necessary because the width of non-character calculated fields cannot be determined until after the SQL cursor is created.

RightClick

Runs the menu specified in the cRightClick_Menu property.

Valid

If the user closes the list without making a selection or selects the same entry that is already in the field, uses the SETFLDSTATE fucntion to signify that the field hasn't been changed.

Runs the field validation routine for the value returned by the IdentifyValidationValue method (by default the value in the Value property of this control).

When

Runs the When routine that returns .T. if this control can receive focus. In determining what value to return, the routine evaluates the When expression from the data dictionary and performs the “Display Only” Field Security check.

Custom Methods:

 

IdentifyActiveForm

Since controls can be placed on both forms and toolbars, and since calls are made in the methods of this control to methods of the active form, this property will contain the object reference of the active form.

IdentifyValidationValue

Called by the Valid event to return the value to be validated. By default, the value in the Value property of the control is returned.

PicklistFKUpdate

If a selection is made on the Picklist form, the PK value of the selected record is placed into the FK field(s) or FK control(s) (if not data-bound) on the active form. This method is called prior to the replacement of the FK values. If the method returns .T. (the default), the replacement occurs. If the method returns .F., the replacement does not occur.

More:

CommandButton_ Class Properties and Methods