Setting Up a Field for Picklist Help Using a Combobox_ Control

When you place a field on a form using a combobox control based on the VPME Combobox_ control class, the field will automatically have Picklist Help if you:

·       Referential Validation: Set up Referential validation for the field, and use the Picklist Builder to define a Picklist with the “<Default>” Picklist ID; or

·       Set Validation: Set up Set validation for the field.

The Picklist is displayed in the combo box’s list. However, if a user places the focus in the field and either (a) presses F2 or (b) right-clicks the field and selects Picklist from the shortcut menu, the Picklist grid will appear.

Tip: You can disable the display of the Picklist grid either (a) by setting the combobox control’s lPicklist property to .F. (false), (b) by turning off the Field Picklist Help on the Admin Tools dialog, or (c) by disabling the F2 key functionality in an application’s main program.

When You Have Multiple Picklist Help Definitions

If you have created more than one Picklist Help definition for a field and if you want to use a Picklist Help definition other than the definition with the “<Default>” Picklist ID, do the following:

1.   Place the field on a form using a combobox control based on the VPME Combobox_ control class.

2.   Enter the Picklist ID of the Picklist Help definition that you want to use into the control’s cPickListID property.

Referential Validation Picklist Help in Combo Box

The combo box list displays each field selected in the Picklist Builder in a separate column. The valid entry, or primary key, field(s) in the Picklist table do not need to be selected in the Picklist Builder. You would only select them if you want them to appear in the combo box list.

The first field selected in the Picklist Builder is the field displayed when the combo box list is not expanded. The first field in the list is the only field with incremental search. None of the fields in the list are sortable.

When you put a field with Picklist Help on a form with the VPME combobox control, the field’s Cusor alias and the field  name are entered into the combobox control’s ControlSource property. However, you can display any field from the Picklist Cursor in the combo box when the combo box list is not expanded. Normally, you choose to display a descriptive field from the Picklist table if the field is a code field.

Ø To set up Picklist Help in the combobox control

1.   First Field: When you use the Picklist Builder to construct a field’s Picklist, the first field listed in the Picklist Builder is displayed when the list is not expanded. Therefore, if you want to display a descriptive field from the Picklist table when the list is not expanded, make the descriptive field the first field listed in the Picklist Builder. Incremental search will be enabled on that field.

2.   Edit the form in the Visual FoxPro Form Designer. Select the field’s combobox control and set the following properties.

3.   cLookupDDTVName: If the Picklist Cursor is not opened through the form’s DE, this property can be used to specify the table, view, or CursorAdapter to be opened. If a table, the extension must be included.

4.   cLookupDDDName: This property is used to specify the database or CursorAdapter library that contains the table, view, or CursorAdapter specified in the cLookupDDTVName property.

5.   cLookupAlias: In the cLookupAlias property enter the alias of the Picklist Cursor that is opened by the form’s DE, or the alias that you want to assign to the Picklist Cursor that is opened through the cLookupDDTVName and cLookupDDDName properties.

6.   If the Picklist Cursor is a table and you want the combobox list to appear in a particular order, you’ll need to add the table to the form’s DE and set the Order property of the table to a tag that defines the order you want. The order tag expression should be based on the first field listed in the Picklist Builder.

7.   The combobox control’s lLookupDescription property must be set to .T., but .T. is the default for the VPME combobox control. Therefore, there’s nothing to do. Just leave this property set to .T.

How to Delete the Descriptive Expression Entry on a Form

There may be times when an application user needs to delete the entry in a combo box that displays a descriptive expression on a form. To delete the entry, simply press the Delete key when the focus is on the combobox control.

The Delete key is the default “reset” key. You can specify the “reset” key and value through properties of the VPME Combobox_ class. For more information, see the following Combobox_ properties in the VPME Technical Reference manual: lKeyPressReset, nKeyPressReset_KeyCode, nKeyPressReset_ShiftAltCtrl and KeyPressResetValue. Also check out the KeyPress event of the Combobox_ control class to see how these properties are used.

Set Validation Picklist Help in Combo Box

When you use Set validation for a field, you enter a set of code values and a description for each code value. If you put the field on a form using the VPME Combobox_ control class, the field will automatically have Picklist Help.

By default, the combo box for a field using Set Validation displays only the code description. However, you can use the lLookupDescription and lShowSetValueAndDescription of the Combobox_ control to determine (a) what the combo box displays and (b) the order in which the code and description are displayed if they are both displayed.

The first column of the table below shows the combo box contents and display order for the four combinations of the lLookupDescription and lShowSetValueAndDescription properties.

Combo Box

lLookupDescription

lShowSetValueAndDescription

Description

.T. (default)

.F. (default)

Code

.F.

.F.

Description, Code

.T.

.T.

Code, Description

.F.

.T.

 

More:

Limiting the Picklist for Views and CursorAdapters