1. How might I display thumbnails of images...
- Posted by lockiedownunder Jul 11, 2009
- 886 views
In my program the User can search the database. Each record has several fields. One field is a sequences of paths to the images associated with that record.
What I would like to do is take the results of the search and display the first image in each record on the screen for the user to choose which record to look at. This may be one or many records in the result.
I currently use cximage which allows me to resize the original image.
2. Re: How might I display thumbnails of images...
- Posted by DerekParnell (admin) Jul 11, 2009
- 885 views
In my program the User can search the database. Each record has several fields. One field is a sequences of paths to the images associated with that record.
What I would like to do is take the results of the search and display the first image in each record on the screen for the user to choose which record to look at. This may be one or many records in the result.
I currently use cximage which allows me to resize the original image.
Have you looked at using the ListView control? It was developed just for that purpose.
3. Re: How might I display thumbnails of images...
- Posted by lockiedownunder Jul 11, 2009
- 950 views
- Last edited Jul 12, 2009
Yeah ListView will work if I can make the icons bigger. Say about 80 x 80.
4. Re: How might I display thumbnails of images...
- Posted by DerekParnell (admin) Jul 11, 2009
- 892 views
- Last edited Jul 12, 2009
Yeah ListView will work if I can make the icons bigger. Say about 80 x 80.
Ok, then make a pixmap with the 80x80 bitmaps drawn in an array fashion then a child window with scrollbars and have it's paint event draw appropriate section of the pixmap on the window's background. The scrollbars would only be needed if the entire set of bitmaps couldn't been seen in the window, of course.
5. Re: How might I display thumbnails of images...
- Posted by lockiedownunder Jul 11, 2009
- 869 views
- Last edited Jul 12, 2009
Bugger I knew a listview was too easy.
Then I just need to work out where on the pixmap the users clicks to load the correct record. Dunno exactly how I will do this. Maybe too complicated for my little brain.
6. Re: How might I display thumbnails of images...
- Posted by DerekParnell (admin) Jul 11, 2009
- 843 views
- Last edited Jul 12, 2009
Bugger I knew a listview was too easy.
Then I just need to work out where on the pixmap the users clicks to load the correct record. Dunno exactly how I will do this. Maybe too complicated for my little brain.
Not difficult. They click on a window not the pixmap. A pixmap is just a RAM image of a bitmap and never seen by the user. That's why one needs to copy pixmaps to windows so they can be seen. Just adjust the click position by the X/Y offset you currently are using for the pixmap painting.
eg. Click occurs at 49,181 and pixmap is being displayed from 165,34, so the relative offset into the pixmap is (49+165, 181+34) = (114,199). Now if the images are 80x80 with 10 pixel margin in between images, the click occurred on the image whose origin is at 90,180, which is the second one across and the third one down.