This Component enables you to easily add a Picklist or Chooser style interface to an application, to provide functionality that mimics the picklists of wizards and other dialogs. The component contains the following Form Builder objects:
The Picklist control is populated and manipulated using two objects called
Lists, named 'List_In' and 'List_Out'. You create an instance
of the Picklist with the Create_Picklist built-in in the Pick_List package.
Only one Picklist can be created in a form at any given time.
Each List contains an array of Elements; these can be populated either from
a query or added and removed explicitly, one by one. Each Element has two properties:
a Label and a Value. The Label is displayed in the list, for example an Employee
Name. The Value is used as necessary in your application; for example, an Employee
Number might be used to fetch other details of an employee. An Element is referenced
by the list, such as 'List_In' or 'List_Out', together with an Index number,
representing its sequential position in the List.
After making changes to the state of the picklist, you must always call Pick_List.Display_Picklist to display the changes. This allows you to make a number of changes to the list without the overhead or nuisance of screen redraw.
To create a picklist:
Creates the structures needed for the picklist reusable component. Call this function to create the picklist before attempting to insert elements..
PROCEDURE Pick_List.Create_Picklist;
Destroys the structures needed for the picklist reusable component. Call this function to release resources associated with the picklist.
PROCEDURE Pick_List.Delete_Picklist;
Populates a picklist with the results of the specified query and returns the Oracle error if any associated with the query.
FUNCTION Pick_List.Populate_Picklist_With_Query(picklist VARCHAR2,
query VARCHAR2);
picklist | Specify the constants PICK_LIST.LIST_IN or PICK_LIST.LIST_OUT. |
query | Specify the query used to populate the picklist. The query must select exactly two columns of type VARCHAR2. The first column will be the label that will appear in the picklist and the second column will be the value. |
Marks the specified element as selected. If keystate is Shift, then a range is marked as selected. If keystate is Control, then the individual element is added to the list of selected elements.
PROCEDURE Pick_List.Set_Picklist_Selection( picklist VARCHAR2,
picklist_index NUMBER,
keystate VARCHAR2)
picklist | Specify the constants PICK_LIST.LIST_IN or PICK_LIST.LIST_OUT. |
picklist_index | The index of the element to select. The first element number is 1. |
keystate | The key modifier, in the same form as :system.mouse_button_shift_state. |
Returns the number of items in the specified picklist that are currently marked as selected.
FUNCTION Pick_List.Get_Picklist_Selection_Count( picklist VARCHAR2);
picklist | Specify the constants PICK_LIST.LIST_IN or PICK_LIST.LIST_OUT. |
Returns the label of the specified element.
FUNCTION Pick_List.Get_Picklist_Element_Label(picklist VARCHAR2,
picklist_index NUMBER);
picklist | Specify the constants PICK_LIST.LIST_IN or PICK_LIST.LIST_OUT. |
picklist_index | The index of the element. The first element number is 1. |
Returns the valueof the specified element.
FUNCTION Pick_List.Get_Picklist_Element_Value(picklist VARCHAR2,
picklist_index NUMBER);
picklist | Specify the constants PICK_LIST.LIST_IN or PICK_LIST.LIST_OUT. |
picklist_index | The index of the element. The first element number is 1. |
Sets the label for the specified element.
PROCEDURE Pick_List.Set_Picklist_Element_Label(picklist VARCHAR2,
picklist_index NUMBER
label VARCHAR2)
picklist | Specify the constants PICK_LIST.LIST_IN or PICK_LIST.LIST_OUT. |
picklist_index | The index of the element. The first element number is 1. |
label | The label for this element |
Sets the value for the specified element.
PROCEDURE Pick_List.Set_Picklist_Element_Value(picklist VARCHAR2,
picklist_index NUMBER
value VARCHAR2)
picklist | Specify the constants PICK_LIST.LIST_IN or PICK_LIST.LIST_OUT. |
picklist_index | The index of the element. The first element number is 1. |
value | The value for this element |
Clears the contents of the picklist.
PROCEDURE Pick_List.Clear_Picklist( picklist VARCHAR2)
picklist | Specify the constants PICK_LIST.LIST_IN or PICK_LIST.LIST_OUT. |
Adds an element to the specified picklist.
PROCEDURE Pick_List.Add_Picklist_Element( picklist VARCHAR2,
picklist_index NUMBER
label VARCHAR2
value VARCHAR2)
picklist | Specify the constants PICK_LIST.LIST_IN or PICK_LIST.LIST_OUT. |
picklist_index | The index of the element. The first element number is 1. |
label | The label for this element |
value | The value for this element |
Deletes the specified element from the picklist
PROCEDURE Pick_List.Delete_Picklist_Element( picklist VARCHAR2,
picklist_index NUMBER);
picklist | Specify the constants PICK_LIST.LIST_IN or PICK_LIST.LIST_OUT. |
picklist_index | The index of the element. The first element number is 1. |
Displays the specified picklist. Note that the displayed state of the picklist does not change until you call this procedure. This allows you to make numerous changes to the picklists without causing screen flicker.
PROCEDURE Pick_List.Display_Picklist( picklist VARCHAR2)
picklist | Specify the constants PICK_LIST.LIST_IN or PICK_LIST.LIST_OUT. |
Moves elements from one list to the other.
PROCEDURE Pick_List.Picklist_Element_Move( from_picklist VARCHAR2
to_picklist VARCHAR2
picklist_option VARCHAR2);
from_picklist | The picklist to move from. Specify the constants PICK_LIST.LIST_IN or PICK_LIST.LIST_OUT. |
to_picklist | The picklist to move to. Specify the constants PICK_LIST.LIST_IN or PICK_LIST.LIST_OUT. |
picklist_option | Specify whether you wish to move only the selected elements or all elements. Use the constants PICK_LIST.PICKLIST_SELECTED or PICK_LIST.PICKLIST_ALL to specify which elements to move. |