Page 1 of 1

Add images to oImageList

PostPosted: Wed Feb 14, 2018 10:02 am
by Natter
Hi, all !

There is a TTreeview object. It contains a set of files of different types. I need to add icons associated with the file type to ::oImageList. I do this:
img=BmpFromIcon( EXTRACTASSICON (0, MyFile, @sol)) - handle bitmap
TTreeview: oImageList:Add(img, NIL)

But get the error: Class 'NUMERIC' has no exported method 'HBITMAP'

What I am wrong ?

Re: Add images to oImageList

PostPosted: Wed Feb 14, 2018 10:50 am
by Antonio Linares
Class TImageList Method Add() expects a Class TBitmap object and not a bitmap handle

Try it this way:

TTreeview: oImageList:Add( TBitmap():Define( ,, oWnd, img ), oWnd )

Re: Add images to oImageList

PostPosted: Wed Feb 14, 2018 12:57 pm
by Natter
Thank You, Antonio ! Work normally