So, I have a bit of a hackjob going on with wx.ListCtrl; and it’s actually going pretty darn good, and working quite cleanly. Even considering its a hack.
The situation is that I have a virtual list in report mode with a desire to put a bit of rich content in columns for display.
The first column is going to be a word indicating status, and a I want the background to have a color to help visually display this. The second column is a small icon. The rest of the columns are basically text.
Problem #1: I couldn’t find a way to set a background color for just one column. So, my solution was to have a single image list for the control of size (100,16) and then populate the list dynamically with images I’m constructing on the fly when needed that have the correct background color and such. Yay! Now I have a per-column background color.
Problem #2: All the images in an ImageList must be the same size. That is where all of my pain comes from So the small icon couldn’t be added; okay, easy enough. I rescale it to be (100,16), and just set the column to a have a set width. Works
Problem #3: This one stumps me. In the middle of doing the sort code for the control, I need to set some sort indicators. I want it pretty, so don’t want to adjust the title to put a textual indicator there, but hey-- I try to do the above and scale the image.
The problem is, that doesn’t entirely work. Because the image is 100px wide, smaller columns end up not ‘fitting’ anymore-- as it is always having to paint out that full space.
I attached a dummied up example of what I’m doing there. Click on slug, then Keywords, then status.
I know its not a bug, but is there a way I can change where/how it prints the indicator? E.g., to start painting right after the text-- instead of from the right and only letting the text go to the end. Alternatively, did I miss some obvious way to solve #1/#2 that locked me into this (100,16) that I don’t need to be?
Thanks.
testcase.py (2.46 KB)