|Help with ImageList and Treeview in comctl32.ocx [message #387539]
||Thu, 19 February 2009 16:13
Registered: February 2009
Location: Costa Rica
I Need to implement Microsoft Tree View (comctl32.ocx) in a form, i follow up an example that i found in this forum but the example doesn't show how to implement the images in the tree, Anybody know how to do this?. I already create a new object with Microsoft Image List (comctl32.ocx) but i don't know how to use the procedures and functions of the library and how to add images to the Image List. |
Now the form is getting me this error "TypeMismatch - Code 13".
The code im using to initialize the Image list is this:
PROCEDURE **** IS
ListImage := :item('LIST.IMAGE_LIST').interface;
Images := COMCTL_IImageList10.ListImages(ListImage);
Image := COMCTL_IImages.Ole_Add (interface => Images,
zIndex => to_variant ('1'),
Key => to_variant ('Pr1'),
Picture => to_variant ('C:\*****.jpg'));
When Form_Ole_Failure then
ErrCode := Last_Ole_Exception ( errSrc,
Gen_Error ('Error: '||errSrc||': '||errDescription);
Pd. Then i need to assing the images in the Image List to the nodes in the Tree View.
|Re: Help with ImageList and Treeview in comctl32.ocx [message #410596 is a reply to message #387539]
||Mon, 29 June 2009 03:47
Registered: June 2009
Location: Magdeburgo, Alemania
i already had the same problem let me tell how to solve it.|
1.-where do you have your tree i dont see it.
2.- You dont need to add the images with code with right click in the image list object > properties and then you search the option for add the icons and then you will be able to add the images one by one selecting the filediectory and putting the key for each one. If you want diferent resolutions for your icons you have to add one image list for each resolution and use your imagination for swtitching from one to another.
3.- you are not telling to the tree that that image list belongs to the tree.
4.- Complete code how i did it:
here you obtain the interface of a tree for your object
x_tree:= GET_INTERFACE_POINTER ('BL_TREE.TREE');
in this one you tell that you want the interface of the image list for attaching the images to the nodes
x_imli:= GET_INTERFACE_POINTER ('BL_TREE.IMAGES');
In this part you asign the image list to the tree
This is an example of one parent node
x_node := MSCOMCTLLIB_iNodes.ole_add(x_nodes, OleVar_empty, to_variant(1), to_variant('A1'), to_variant('Auftrag'),to_variant(3));<-- this is the variable for the image, in this one you tell to the tree that the image with the index # belongs the that node.
i hope that this can help you.
[Updated on: Mon, 29 June 2009 03:49]
Report message to a moderator