1. Draw OCX control on form.
2. Right click on OCX control and Insert Object "Microsoft ListView Control 6.0"
3. Import OLE Library Interfaces "MSComctlLib.ListViewCtrl.2" (
4. Set Data Block Single Record to YES
5. Set OLE Class of Listview control to "MSComctlLib.ListViewCtrl.2"
6. Rename listview control to "LVWTAB" and Data Block to "B1"
6. Add the following code to the "WHEN_NEW_FORM_INSTANCE" Trigger (Make Sure You Have Access To ALL_TABLES)
DECLARE
hColHeads MSComctlLib_CONSTANTS.IColumnHeaders;
hColHead MSComctlLib_CONSTANTS.IColumnHeader;
hListItems MSComctlLib_CONSTANTS.IListItems;
hListItem MSComctlLib_CONSTANTS.IListItem;
hListSubItems MSComctlLib_CONSTANTS.IListSubItems;
hListSubItem MSComctlLib_CONSTANTS.IListSubItem;
-- Error Handler variables
errCode pls_integer;
errSrc varchar2(200);
errDescription varchar2(2000);
errHelpfile varchar2(200);
errHelpContext pls_integer;
CURSOR cAllTables IS
SELECT * FROM all_tables;
BEGIN
errDescription := NULL;
MSCOMCTLLIB_ILISTVIEW.ole_view

item('B1.lvwTab').interface, MSComctlLib_CONSTANTS.lvwReport);
hColHeads := MSCOMCTLLIB_ILISTVIEW.ColumnHeaders

item('B1.lvwTab').interface);
hColHead := MSCOMCTLLIB_ICOLUMNHEADERS.ole_add(
interface => hColHeads
,zIndex => TO_VARIANT(1)
,key => TO_VARIANT('TABLE')
,text => TO_VARIANT('Table Name')
,width => TO_VARIANT(500)
,Alignment => OleVar_Null
,icon => OleVar_Null
);
hColHead := MSCOMCTLLIB_ICOLUMNHEADERS.ole_add(
interface => hColHeads
,zIndex => TO_VARIANT(2)
,key => TO_VARIANT('OWNER')
,text => TO_VARIANT('Owner')
,width => TO_VARIANT(500)
,Alignment => OleVar_Null
,icon => OleVar_Null
);
hListItems := MSCOMCTLLIB_ILISTVIEW.ListItems

item('B1.lvwTab').interface);
MSCOMCTLLIB_ILISTITEMS.clear

item('B1.lvwTab').interface);
FOR rAllTables IN cAllTables LOOP
hListItem := MSCOMCTLLIB_ILISTITEMS.ole_add (interface => hListItems);
MSCOMCTLLIB_ILISTITEM.text(hListItem,rAllTables.table_name);
hListSubItems := MSCOMCTLLIB_ILISTITEM.ListSubItems(hListItem);
MSCOMCTLLIB_ILISTSUBITEMS.clear(interface => hListSubItems);
hListSubItem := MSCOMCTLLIB_ILISTSUBITEMS.ole_add ( interface => hListSubItems
,zIndex => TO_VARIANT(1)
,Key => TO_VARIANT('FileDesc')
,text => TO_VARIANT(rAllTables.owner)
,ReportIcon => OleVar_Null
,ToolTipText => OleVar_Null
);
END LOOP;
NULL;
exception
when others then
errCode := last_ole_exception( errSrc,
errDescription,
errHelpfile,
errHelpContext);
message('Error Raised by ->'||errSrc||': '||errDescription);
END;
Bobs your uncle a MS Listview Control built and populated. Use the package "MSComctlLib_ListViewCtr_EVENTS" to react to List View Events.
Have fun !!
John Mason