Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Oracle Forms 6i And MS Listview Control - SubItems Problem

Status
Not open for further replies.

Johhnno

Programmer
Feb 10, 2003
2
GB
I'm currently attemtping to use the MS Listview Control on a Oracle Form. At present I've magaged to add 2 columns to the control and populate the first column from an underlying table.

However when I attempt to populate the second column using the SubItems property I get the error message "An OLE Error Occurred 0x8002003 " which is member not found.

Has anyopne had any joy in adding and using such a control.

In VB its fairly simple to use and a big hit with users !

Any help greatly appreciated.

Cheers.

Johhnno.
 
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




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top