Editing the Picklist Table

Picklist Help allows a user of your application to add and edit records in a field’s Picklist table when the field is selected on a form. This add and edit feature is activated for a field by simply entering the name of the Picklist table’s edit form in the Add/Edit Form box on the Picklist Builder for the field. You, of course, must have previously created a form to edit the Picklist table.

How to Display the Edit Form

A user can display the Picklist table edit form in either of two ways when a field is being edited on a form:

1.   Shortcut Menu: Right-click on the field to display a shortcut menu. Click the Add New or Edit option on the shortcut menu. The Picklist table’s edit form will be displayed in add or edit mode depending on which menu option you click.

2.   Picklist Grid Buttons: Display the Picklist grid and click the Add or Edit buttons. The Picklist table’s edit form will be displayed in add or edit mode depending on which button you click.

   To display the Picklist grid for a field, place the focus in the field and either (a) press F2, (b) right-click the field and select Picklist from the shortcut menu or (c) click the picklist icon.

Default and Alternative Add Record Behavior

Default Add Record Behavior: By default when you click the Add New option on the short cut menu or the Add button on the Picklist grid, the Picklist table edit form comes up in the add mode. When the first new record you add is saved, the primary key value of that new record is placed in the field (foreign key) on the underlying form you are editing. You can at that point add and edit additional Picklist table records before closing the Picklist table edit form and returning to the underlying form.

Alternative Add Record Behavior: You can modify this default behavior so that the Picklist table edit form is closed immediately after the new record is saved or cancelled. This alternative behavior will only allow a record to be added – one at a time. You might choose this behavior to limit what users can do on the Picklist table edit form. Perhaps, you want to allow users to add records to the Picklist table, but you don’t want them to freely edit any record in the Picklist table, view or CursorAdapter.

To Activate Alternative Behavior: To activate the alternative Add record behavior, all you have to do is set the lFKUpdateOneAdd property of the field’s textbox or combobox control, whichever applies, to .T. (true). You set this property when you are editing the field’s form in the Visual FoxPro Form Designer.

Ø To edit a field’s Picklist table

1.   Create an edit, or data maintenance, form for the Picklist table.

2.   Enter the name of the Picklist table data edit form in the Add/Edit Form box on the Picklist Builder for the field. An entry in the Add/Edit Form box causes the Add New and Edit options to be enabled on the shortcut menu and causes the Add and Edit buttons to be displayed on the Picklist grid.

3.   If you wish to activate the alternative Add record behavior, edit the field’s form in the Visual FoxPro Form Designer and set the lFKUpdateOneAdd property of the field’s textbox or combobox control, whichever applies, to .T. (true).

The users of your application can turn this Add/Edit feature on and off for a field if you include the Data Manager in your application. Users can simply enter or remove the name of the Picklist table edit form in the Add/Edit Form box on the Picklist Builder for the field.

Assigning Edit Right to Application Users

The system administrator of an application can choose which users have the right to edit the Picklist table. If the system administrator assigns a user the Picklist Add/Edit right on the Users form, that user will have the right to edit the Picklist table. If a user does not have the right to edit the Picklist table, the Add New and Edit shortcut menu options are disabled and the Add and Edit buttons will not appear when the Picklist grid is displayed for a field.

The system administrator must turn User Access Security on to make the Picklist Add/Edit right operable. If User Access Security is not on, all users have the right to edit a Picklist table that is made editable for a field. See the section Users in the Security chapter for an explanation of User Access Security and the Picklist Add/Edit right.

Ø To make a Picklist table editable for a user

1.   Select the Users option on the application Security menu. You reach the Security menu from the application's Admin menu. VPM Enterprise displays the Users form.

2.   Find the user to whom you want to give the right to edit the Picklist table.

3.   Click the Picklist Add/Edit check box in the Authorization box. Click the Save toolbar control to save your entry.

More:

Setting Up a Field for Picklist Help Using a Textbox_ Control