Widget for recreating a file manager-style large icon, grid-like, horizontally wrapping list? Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
prospero
Earned a small fee
Earned a small fee
Posts: 14
Joined: Sat Jan 08, 2022 3:17 pm

Widget for recreating a file manager-style large icon, grid-like, horizontally wrapping list?

Post by prospero »

For example, something that resembles: https://i.stack.imgur.com/Zc0jk.png

The most obvious option so far is wxListCtrl with the wxLC_ICON style, but it doesn't seem workable. I tried with wxLC_ALIGN_LEFT, and while it aligns things the right way (horizontally, left to right), it doesn't wrap the list to continue on the row beneath, instead creating a horizontal scroll bar on the bottom. wxLC_ALIGN_TOP gives the wrong orientation, and the two of them together doesn't work either.

It appears if need be, I can cobble together something with wxWrapSizer and wxScrolledWindow.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7479
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Widget for recreating a file manager-style large icon, grid-like, horizontally wrapping list?

Post by ONEEYEMAN »

Hi,
I presume you work under Linux with GTK+3?
And you are trying the latest version of wxWidgets which 3.2.0?

What exact version of GTK do you have?
What do you men by saying "but it doesn't seem workable"? Does it give you compiler error? Is it crashing?
Can you build and run the listctrl sample and see if it works for you?

Thank you.
prospero
Earned a small fee
Earned a small fee
Posts: 14
Joined: Sat Jan 08, 2022 3:17 pm

Re: Widget for recreating a file manager-style large icon, grid-like, horizontally wrapping list?

Post by prospero »

Apparently to get what I want with wxListCtrl (icons laid out from left to right, but wrapping to the next row when needed, ultimately forming a kind of matrix or grid), you need to specify wxLC_ICON and neither wxLC_ALIGN_TOP nor wxLC_ALIGN_LEFT; just leave the alignment unspecified. Otherwise, if you use wxLC_ALIGN_TOP, you get some never-wrapping top-to-bottom list, and with wxLC_ALIGN_LEFT, you get some never-wrapping left-to-right list. Somewhat confusing, I think.
Post Reply