1. ImageList Questions
- Posted by ssallen Oct 10, 2009
- 1141 views
Hi Everyone,
I don't get the ImageList controls and the documentation is a bit sparse. Could someone explain how to get one's feet wet with them?
Basic Questions:
Image Lists - It seems like I need to create one and add my images too it with the addDib/EuBmp/etc. functions but they only take one argument... how do I keep my imagelists seperate? If I have two different controls I want to pass bitmaps between how do I know what goes where? I guess I want to know where I get the imagelist handle from.
Also, do I just create a ListView and assume that it will handle my images when I pass them?
What does *size* mean as an argument to the setImageList procedure?
Visual of what I want to do:
Window1 Window2
----------- ---------
+ Image 1 + > + Image 3 + + Image 4 +
+ Image 2 + <
----------- ---------
What I want to be able to do is drag Image 1 to Window 2 and vice versa. I am going to be transferring thumbnails of images that are indexed back to the full size image and tracking the locations internally. I just can't figure out how this mechanism works.
Thanks! Steve A.
2. Re: ImageList Questions
- Posted by ssallen Oct 14, 2009
- 1072 views
So... were my questions just that dumb or am I treading on relatively new ground here? Anybody?
Thanks!
Steve A.
3. Re: ImageList Questions
- Posted by mattlewis (admin) Oct 14, 2009
- 1102 views
- Last edited Oct 15, 2009
Hi Everyone,
I don't get the ImageList controls and the documentation is a bit sparse. Could someone explain how to get one's feet wet with them?
What library are you using? I'm going to assume Win32Lib. I wrote the original ImageList support, but it's been a while. An ImageList is the way that some controls organize the images that they display. Basically, you put the images into the ImageList, and then you can simply refer to the index of each image, rather than using handles, and possibly duplicating images in memory.
Basic Questions:
Image Lists - It seems like I need to create one and add my images too it with the addDib/EuBmp/etc. functions but they only take one argument... how do I keep my imagelists seperate? If I have two different controls I want to pass bitmaps between how do I know what goes where? I guess I want to know where I get the imagelist handle from.
I think that Win32lib creates a few for you, so that you don't really need to manage them separately. It's a trade off between complexity and functionality, IIRC. Looking at the source code, I believe that win32lib automatically associates the correct ImageList with the control when it is created.
What I want to be able to do is drag Image 1 to Window 2 and vice versa. I am going to be transferring thumbnails of images that are indexed back to the full size image and tracking the locations internally. I just can't figure out how this mechanism works.
I think that all you need to do is to track the image's index vs the source image. So when you need to set the image for some item in a control (I guess a ListView in this case), you use the ImageList index. But as long as you keep the handle or file name, or whatever you need to track for the image, you can translate back and forth.
The drag and drop stuff is a whole 'nother ball of wax.
Matt
4. Re: ImageList Questions
- Posted by ssallen Oct 15, 2009
- 1042 views
My apologies,
Yes I am using Win32lib. I guess my question is how to interact with the ImageLists. For instance, the documentation only lists five routines for ImageLists:
- func addDIB( hBmp ) Adds DIB's to win32lib's imagelists
- func addEuBmp( bmp ) Adds EuBitmaps to win32lib's imagelists
- func addIcon( hIcon ) Adds icons to win32lib's imagelists
- func addXpm( xpm ) Adds xpm's to win32lib's imagelists
- proc setImageList( integer id, atom IL, atom size )
The first four are plain enough to understand but the 5th asks for arguments I dont understand. I image id is the control ID (i.e. List81 or whatever) but how do I get the handle for IL... and what exactly does size want? If I can't create an ImageList how do I get its handle? Is size the amount of pixels per image or total of all images?
Thats probably my core questions.
Thanks Matt!
Steve A.