Efficient way of display thumbnails

Are you writing your own components and need help with how to set them up or have questions about the components you are deriving from ? Ask them here.
josemarin
Knows some wx things
Knows some wx things
Posts: 31
Joined: Wed Nov 16, 2005 10:38 am

Efficient way of display thumbnails

Post by josemarin »

Hi!

My application needs to display several thumbnails (small images with a legend).

It may come from files, or generated on the fly ("virtual" thumbnails).

Is there an efficient way of do this?

Thanks!
upCASE
Moderator
Moderator
Posts: 3176
Joined: Mon Aug 30, 2004 6:55 am
Location: Germany, Cologne

Re: Efficient way of display thumbnails

Post by upCASE »

Hi!
josemarin wrote:Hi!

My application needs to display several thumbnails (small images with a legend).

It may come from files, or generated on the fly ("virtual" thumbnails).

Is there an efficient way of do this?
Well, that is a pretty general question...
If you own the wxBook, you may want to look at the Riffle application. It has a thumbnail control you could use or extend.

However, there may be other ways to do that. I developed a small application called VidBeacon which gets animated thumbnails from movies and stills from images, displays them and allows the user to click them (for playback of movie files and shwoing images). I used a wxPanel as the base class and paint the images in OnPaint(). The info is displayed by wxStaticText controls. Mouse handling is the same as with other apps, except that I wrote my own event class for passing all needed info. Creating a simple thumbnail control isn't very hard to do.
For displaying all thumbs I used a wxScrolledWindow with a wxGridSizer and add the tumbnails accordingly.

VidBeacon hasn't been release yet, as there are some issues with it (sampling the images for movies doesn't work in all cases and storing the thumbs for later preview using a DB is sometimes too slow). Maybe I find some time today and add it to my site and post an announcement here. It's basically a simple app I wrote for personal use, but it may be a free replacement for something like Acdsee, although it hasn't nearly as much features...
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4

"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda
josemarin
Knows some wx things
Knows some wx things
Posts: 31
Joined: Wed Nov 16, 2005 10:38 am

Post by josemarin »

I'm thinking on design the app with multiple pages (I'll use wxNotebook); on each page I will insert a wxGrid, and define a wxGridCellRenderer to render the cells.

Talking about wxNotebook, I've read somewhere (can't remember where), that on MacOS it's not possible to have a wxNotebook with more tabs that can be displayed. There is no "NextPage" or "PrevPage" buttons. It's that true?

It's possible to create a wxGrid without column headers or the first column?

I'll need only the grid.
upCASE
Moderator
Moderator
Posts: 3176
Joined: Mon Aug 30, 2004 6:55 am
Location: Germany, Cologne

Post by upCASE »

Hi!
josemarin wrote:I'm thinking on design the app with multiple pages (I'll use wxNotebook); on each page I will insert a wxGrid, and define a wxGridCellRenderer to render the cells.
Personally I think that using wxGrid won't be very suitable, but then again I don't really know what you're up to ;)
josemarin wrote:Talking about wxNotebook, I've read somewhere (can't remember where), that on MacOS it's not possible to have a wxNotebook with more tabs that can be displayed. There is no "NextPage" or "PrevPage" buttons. It's that true?
I'm not sure what you mean. From what I've heard, wxNotebook work well on Mac, although the layout is pretty different from Windows.
josemarin wrote:It's possible to create a wxGrid without column headers or the first column?
I guess not, as you can only set the height of the column headers in general.
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4

"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda
josemarin
Knows some wx things
Knows some wx things
Posts: 31
Joined: Wed Nov 16, 2005 10:38 am

Post by josemarin »

I'll try to be more clear:

Imagine a clipart viewer.

We could have a wxNotebook with several pages.

The images of each page are grouped by category (people, nature, symbols, etc).

Maybe it would be faster if I use a wxScrolledWindow, and draw the images myself.
josemarin
Knows some wx things
Knows some wx things
Posts: 31
Joined: Wed Nov 16, 2005 10:38 am

Post by josemarin »

I think that the whole problem is DESIGN!

Do you know some paper or tutorial on how to design good visual applications?
toxicBunny
Super wx Problem Solver
Super wx Problem Solver
Posts: 424
Joined: Tue Jul 12, 2005 8:44 pm
Location: Alabama, USA

Post by toxicBunny »

Although I don't personally use a Mac, I believe you are right about it not using multiple rows of tabs or being able to scroll the tabs. I think this is one reason why wxListbook was developed. Have you thought of using this instead? I used it in place of a notebook in one application and was very satisfied.

As for drawing the images, I'd agree with upCASE that it would be easier and faster to use a wxScrolledWindow and a wxGridSizer than to use the wxGrid control.

-Scott
josemarin
Knows some wx things
Knows some wx things
Posts: 31
Joined: Wed Nov 16, 2005 10:38 am

Post by josemarin »

Thanks for your tips, guys!

I'll spend more time on the design of my application, and do some experiences.
phlox81
wxWorld Domination!
wxWorld Domination!
Posts: 1387
Joined: Thu Aug 18, 2005 7:49 pm
Location: Germany
Contact:

Post by phlox81 »

Acutally for displaying you can take a StaticBitmap, works very well.
upCASE
Moderator
Moderator
Posts: 3176
Joined: Mon Aug 30, 2004 6:55 am
Location: Germany, Cologne

Post by upCASE »

phlox81 wrote:Acutally for displaying you can take a StaticBitmap, works very well.
Right. This would work as well. I didn't use a static bitmap because the size of the thumbs is different each time and I had some problems in updating properly.
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4

"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda
Ken_Afford
In need of some credit
In need of some credit
Posts: 2
Joined: Sun Apr 17, 2005 9:33 pm

Post by Ken_Afford »

hi! i also would like to create a scrolled window that displays thumbnails of images but i would like mine to have no definite number of rows or columns. images will adjust depending on the frame size like windows explorer or package manager of dev-c++. Do you guys have any idea how to do this?

the only solution i can think of is using wxHTML. am i going in the right direction?
Anil8753
Experienced Solver
Experienced Solver
Posts: 93
Joined: Sat Jan 16, 2016 5:57 am
Location: India

Re: Efficient way of display thumbnails

Post by Anil8753 »

@Ken_Afford
Did you get solution?
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Efficient way of display thumbnails

Post by doublemax »

This can be done with a wxWrapSizer.
http://docs.wxwidgets.org/trunk/classwx_wrap_sizer.html
Use the source, Luke!
Anil8753
Experienced Solver
Experienced Solver
Posts: 93
Joined: Sat Jan 16, 2016 5:57 am
Location: India

Re: Efficient way of display thumbnails

Post by Anil8753 »

wxWrapSizer can be used. Only thing is the performance when I want to treat as wxDataViewCtrl (lots of add/delete/update) in the items.
Did you guys found some solution? My requirement is to display 10K image items.
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Efficient way of display thumbnails

Post by doublemax »

I would probably build something myself based on wxHVScrolledWindow.
http://docs.wxwidgets.org/trunk/classwx ... indow.html
Use the source, Luke!
Post Reply