I'm attempting to get the appearance of the control area of a wx.ListBook without actually having to create and add multiple pages to it. (In other words, I don't want Notebook functionality here, just the area with the images that can be selected.)
While a ListBook can display an endless line of images with LB_TOP specified, I've been unsuccessful accomplishing the same thing with a ListCtrl. A ListCtrl with LC_ICON specified looks exactly the same, and as I understand it the ListBook even uses a ListCtrl under the covers for the control area, but there's no obvious way to get a ListCtrl to provide only a horizontal scroll bar.
The ListCtrl I'm working with automatically resizes when I add enough items to exceed the current width, and it adds a vertical scrollbar to fit everything in.
Any pointers on what to do? I've tried overriding resizing with EVT_SIZE but that seems to have no effect.
I'm attempting to get the appearance of the control area of a wx.ListBook without actually having to create and add multiple pages to it. (In other words, I don't want Notebook functionality here, just the area with the images that can be selected.)
While a ListBook can display an endless line of images with LB_TOP specified, I've been unsuccessful accomplishing the same thing with a ListCtrl. A ListCtrl with LC_ICON specified looks exactly the same, and as I understand it the ListBook even uses a ListCtrl under the covers for the control area, but there's no obvious way to get a ListCtrl to provide only a horizontal scroll bar.
The ListCtrl I'm working with automatically resizes when I add enough items to exceed the current width, and it adds a vertical scrollbar to fit everything in.
Any pointers on what to do? I've tried overriding resizing with EVT_SIZE but that seems to have no effect.
You can always cheat and read the implementation of wx.ListBook
The ListCtrl I'm working with automatically resizes when I add enough items to exceed the current width, and it adds a vertical scrollbar to fit everything in.
Any pointers on what to do? I've tried overriding resizing with EVT_SIZE but that seems to have no effect.
You can always cheat and read the implementation of wx.ListBook
[snip URL]
Thanks, Robin. I had been trying that, but so far had only managed to navigate through to bookctrl.cpp (not too familiar with the C++ source) which wasn't doing much for me.
You've put me on the right track: specifying wx.LC_ALIGN_LEFT seems to be the primary thing required, but in any case I'll post a followup once I've got it polished up and understand what I'm doing.
The ListCtrl I'm working with automatically resizes when I add enough items to exceed the current width, and it adds a vertical scrollbar to fit everything in.
You can always cheat and read the implementation of wx.ListBook
...
You've put me on the right track: specifying wx.LC_ALIGN_LEFT seems to be the primary thing required, but in any case I'll post a followup once I've got it polished up and understand what I'm doing.
Here's the followup, since the result has been working and we haven't seen a reason to change it for a while. (Code slightly edited:)
# force size to include space for scrollbar so it doesn't obscure
# the contents if it gets displayed later
_, h = self.stepsList.GetSize()
myCtrl.SetMinSize((-1, h +
wx.SystemSettings.GetMetric(wx.SYS_HSCROLL_Y) + SPACE))
Basically that gives us a ListCtrl which arranges its icons horizontally both on Windows and Mac, allows single selection, and leaves space for the horizontal scrollbar which will appear whenever needed. (The latter was our preferred approach to allowing the list to resize dynamically, as doing so resulted in the contents of the panel below the list jumping up and down as the list changed its size, which was quite a disconcerting effect and a problem we had with the original ListBook as well.)
The only thing required to meet my original requirement was to add the wx.LC_ALIGN_LEFT style, which is the first obvious thing I found in the wx.ListBook source code.