It is quite possible to use multiple selections in a list view. We have now built a complete application using listviews and includes functionality to update a column value for multiple selected rows... Here is a small piece of code....
PROCEDURE NOTES_BTN IS
hListItem MSComctlLib_CONSTANTS.ILis
hListItems MSComctlLib_CONSTANTS.ILis
hListSubItems MSComctlLib_CONSTANTS.ILis
hListSubItem MSComctlLib_CONSTANTS.ILis
nListCount INTEGER;
nListSubCount INTEGER;
nSelectedCount INTEGER;
vFileHistoryId NUMBER(10);
CURSOR cNote (pFileHistoryId IN VARCHAR2) IS
SELECT updated_notes, status_id
FROM REJECTION_REASON
WHERE FILE_HISTORY_ID = pFileHistoryId;
BEGIN
nSelectedCount :=0;
:b1.txt_notes:=null;
:b1.list_status:=null;
IF MSCOMCTLLIB_ILISTVIEW.Sele
-- Use actual listview. The comment underneath shows how to use interface passed in to procedure.
hListItems := MSCOMCTLLIB_ILISTVIEW.List
--hListItems := MSCOMCTLLIB_ILISTVIEW.List
nListCount := MSCOMCTLLIB_ILISTITEMS.ole
FOR nInt IN 1 .. nListCount LOOP -- Loop round all records in Listitems
hListItem := MSCOMCTLLIB_ILISTITEMS.ite
--Vrecord := MSCOMCTLLIB_ILISTITEM.text
hListSubItems := MSCOMCTLLIB_ILISTITEM.List
nListSubCount := MSCOMCTLLIB_ILISTSUBITEMS.
IF MSCOMCTLLIB_ILISTITEM.sele
nSelectedCount := nSelectedCount +1;
hListSubItem := MSCOMCTLLIB_ILISTSUBITEMS.
vFileHistoryId := MSCOMCTLLIB_ILISTSUBITEM.t
END IF;
END LOOP;
IF nSelectedCount = 1 then --If only 1 record selected then populate notes screen with existing note and status
FOR rNote IN cNote (vFileHistoryId) LOOP
--Populate notes and status items with values in rejection_reason table
:b1.txt_notes:=rNote.updat
:b1.list_status:=rNote.sta
exit;
END LOOP;
END IF;
go_item('b1.txt_notes');
ELSE
--IF hListItem is null THEN
message('Please Select A Rejection Record To Update');
go_item('b1.list_file_type
:GLOBAL.errored := 'TRUE';
raise form_trigger_failure;
END IF;
Main Topics
Browse All Topics





by: venkotchPosted on 2003-04-25 at 06:37:56ID: 8395183
You get the item value using t_name, list_index);
t_name, list_index)
ist_name); ist_name, v_idx);
Get_List_Element_Value(lis
However, the simplest way is to reference the item:
my_curr_list_value := :List_Name;
The list labels (what you see on the screen) you can get using
Get_List_Element_Label(lis
The list_index is the sequential number of the item in the list. It is tough each time to figure out the index, so to get the index of the selected item in the list I wrote a function:
FUNCTION Get_List_Idx (p_list_name IN varchar2) RETURN NUMBER IS
v_idx number;
v_curr_value varchar2(1024) := '';
v_list_value varchar2(1024);
v_list_count number;
BEGIN
v_list_value := Name_IN(p_list_name);
v_list_count := Get_List_Element_Count(p_l
if v_list_value is not NULL then
v_idx := 1;
LOOP
v_curr_value := Get_List_Element_Value(p_l
EXIT WHEN (v_curr_value = v_list_value) or (v_idx > v_list_count);
v_idx := v_idx + 1;
END LOOP;
end if;
return NVL(v_idx,1);
Exception
When Others then
return 1;
END Get_List_Idx;
It is not possible to do multiple selections within the list, but you can use hierarchical tree control to do this.
Hope this helps,
Venko