Home » Developer & Programmer » Forms » Microsoft TreeView Control 6.0 (Forms 6i, Windows XP)
Microsoft TreeView Control 6.0 [message #391800] Fri, 13 March 2009 10:04 Go to next message
chrisvelarde
Messages: 5
Registered: March 2009
Junior Member
I'd like to implement a treeview control with checkboxes in every node using Microsoft TreeView Control 6.0 in Forms 6i. I already did the following steps:

1. Download and register OCX (regsvr32 C:\windows\system32\comctl32.ocx)
2. Draw OCX control on form.
3. Right click on OCX control and Insert Object "Microsoft TreeView Control 6.0"
4. Import OLE Library Interfaces "MSComctlLib.TreeCtrl.2"
5. Set Data Block Single Record to YES
6. Set OLE Class of Listview control to "MSComctlLib.TreeCtrl.2"
7. Rename treeview control to "ACX_TREE" and Data Block to "BLK_CONTROLS"

Now I need to populate the treeview adding code to the "WHEN_NEW_FORM_INSTANCE" Trigger, but I donĀ“t see how.
Does someone know how to do this and/or a place where I can find a working example?
Re: Microsoft TreeView Control 6.0 [message #391960 is a reply to message #391800] Sun, 15 March 2009 02:38 Go to previous messageGo to next message
chrisvelarde
Messages: 5
Registered: March 2009
Junior Member
I found the solution,

First you have to make sure that there is no other item in the TreeView's block, so I renamed the block to "BLK_TREE".

Then you add the code to the ""WHEN_NEW_FORM_INSTANCE" Trigger.
The following lines show an example code, that crates statically one root node and 3 child nodes:


declare

  hNodes    MSComctlLib_CONSTANTS.iNodes;
  hNode     MSComctlLib_CONSTANTS.iNode;

 -- Error Handler variables
  errCode             pls_integer;
  errSrc              varchar2(200);
  errDescription      varchar2(2000);
  errHelpfile         varchar2(200);
  errHelpContext      pls_integer;

begin 

--  Show the Expansion Indicators and Lines and Text
MSCOMCTLLIB_ITREEVIEW.Style(:item('BLK_TREE.ACX_TREE').interface,6);

--  Get the Handle to the Nodes Collection
hNodes := MSCOMCTLLIB_ITREEVIEW.nodes(:item('BLK_TREE.ACX_TREE').interface);

--  Add NODES, every node should have a different "key"
--  and should begin with a Alpha Char not a numeric

--ROOT NODE 
hNode := MSCOMCTLLIB_iNodes.ole_add
(
interface    => hNodes,
Relative     => olevar_empty,
Relationship => to_variant(1),
Key          => to_variant('Node1'),
Text         => to_variant('Node 1')
);
release_obj(hNode);

-- Add child NODES
hNode :=  MSCOMCTLLIB_iNodes.ole_add
(
Interface    => hNodes,
Relative     => to_variant('Node1'),
Relationship => to_variant(4),
Key          => to_variant('Node 1.1'),
Text         => to_variant('Node 1.1')
);
release_obj(hNode);

hNode :=  MSCOMCTLLIB_iNodes.ole_add
(
Interface    => hNodes,
Relative     => to_variant('Node1'),
Relationship => to_variant(4),
Key          => to_variant('Node 1.2'),
Text         => to_variant('Node 1.2')
);
release_obj(hNode);

hNode :=  MSCOMCTLLIB_iNodes.ole_add
(
Interface    => hNodes,
Relative     => to_variant('Node1'),
Relationship => to_variant(4),
Key          => to_variant('Node 1.3'),
Text         => to_variant('Node 1.3')
);
release_obj(hNode);

        
release_obj(hNodes);
      

exception
  when form_ole_failure then 
        errCode := last_ole_exception( errSrc,
                                      errDescription,
                                      errHelpfile,
                                      errHelpContext);
        message('Error Raised by ->'||errSrc||': '||errDescription); 

END;




Enjoy Cool

[Updated on: Sun, 15 March 2009 02:40]

Report message to a moderator

Re: Microsoft TreeView Control 6.0 [message #579842 is a reply to message #391960] Sat, 16 March 2013 01:03 Go to previous messageGo to next message
himacsoft
Messages: 14
Registered: May 2011
Junior Member
Dear Sir,

I am in truble while iam developing this program so, Kindly send the fmb file for the same. Thanking you.

[Updated on: Sat, 16 March 2013 01:18]

Report message to a moderator

Re: Microsoft TreeView Control 6.0 [message #579870 is a reply to message #579842] Sat, 16 March 2013 05:02 Go to previous messageGo to next message
chrisvelarde
Messages: 5
Registered: March 2009
Junior Member
Don't have the file anymore, but this may help:

Make sure you have imported all of the following package bodies and specifications:
MSComctlLib_ItreeView
MSComctlLib_Inodes
MSComctlLib_Inode
MSComctlLib_TreeCtrl_2_EVENTS
MSComctlLib_CONSTANTS (only specification)

The Treeview object manages three different types of objects, which have the following hierarchy:
1. The TreeView itself (The package MSComctlLib_ItreeView contains its respective functions and procedures)
2. A "tree" or node collection (The package MSComctlLib_Inodes contains its respective functions and procedures)
3. Nodes (The package MSComctlLib_Inode contains its respective functions and procedures)

The Nodes are contained in a Node Collection and Node Collections can be displayed in a TreeView.
The package MSComctlLib_CONSTANTS gives a good reference about the values of each treeview-property.

If you could be a little more specific about your trouble, perhaps we may shoot it. Smile
Re: Microsoft TreeView Control 6.0 [message #579878 is a reply to message #579870] Sat, 16 March 2013 07:13 Go to previous message
mughals_king
Messages: 392
Registered: January 2012
Location: pakistan
Senior Member
download this fmb and enjoy




mughal
Previous Topic: FRM-40735: WHEN - CUSTOM -ITEM -EVENT trigger raised unhandled exception ORA-06509
Next Topic: read image from a directory
Goto Forum:
  


Current Time: Mon Nov 04 11:24:44 CST 2024