Make a list view highlight truecolour (win32 or wxWidgets) [SOLVED]

Started by
12 comments, last by Andrew Russell 18 years, 9 months ago
OK, I'm using wxWidgets, but if you can tell me how to do it in win32 that would be much appreciated - I can probably find the relevent code with that info. I am doing a big refactor of some old code, and I'm using a list view as a texture browser. Now, my old code works fine, the highlight is in the true-colour style. My new code, which is almost a direct copy from the old, has a 256-colour style highlight. This is what I mean: Same image at 2x magnification: The one on the left is from the old version, the one on the right is the new version (as in - the icon, not the image - they are both the same image, increased in size for visibility). I'm using the same version of wxWidgets for both, and so I know it's not that. I vaugly remember having trouble getting it working correctly the last time around too. Unfortunatly I've left myself no comments on how it was done, and there is certianly no "Use the true-colour highlight" option that is obvious in the API. Any help is much appreciated. [Edited by - Andrew Russell on July 11, 2005 6:26:15 AM]
Advertisement
Additional note - SetUseBestVisuals(true) - has no effect. Both of the screenshots were taken with it in the code, and the sample where it also works in true-colour, it isn't.
*bump*
It could be the color blindness, but I can't tell the difference between those two images. Is there any other way for you to describe what you want to do?
Just to be clear the images are the same - it is the icons that are different - they are screenshots from two different programs. I'll edit the post to make it clearer.


The icon on the left is what I'm aiming for. Basically - when it is selected, it takes on a blue tint. The icon on the right is what I currently have - the selection is indicated by setting certian pixels to normal dark blue using a pattern like this:
X X X X  X X X XX X X X  X X X X

In other words - correct one is using a true-colour method, the other is using the method in 256-colour mode (I'm not actually sure about the number of colours actually being used - but the highlight method is the same).

Although I'm using wxWidgets - if someone knows how to change between the two in win32, I can probably work out how to do it in wxWidgets (or hack it in).


I've been working to "fix" the broken version by copying in code from the working version. The code is now, pretty much identical to the working version in all the parts that should make a difference (the creation of the list view and image list, the loading of the images, manipulation of the list, etc), yet it's still broken. So it's something very obscure. I will now try to break the working version by copying various bits of the broken code over it to see what breaks it.
I don't know, but the new one is dithering with the selection colour, while the old one is actually blending the two. Those terms might help you to track down the solution. I've done a bit of looking, but I can't find any information on it.
What color flags are you passing to the imagelist you use for the List Control?
I never noticed on the selection part (i usually use only report view), but i've had problems with color depths below 15/16 bit before.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

My experience has been (with Win32) that List Views and other controls use the system palette... at least in older Windows OS's...

Not that that helps... but I'm not sure a Win32 List View's highlighting can be de-coupled from the display settings... at least automatically. (Could be wrong)... XP's themes I know nothing about, however.

You may have a "custom draw" operation staring you in the face :-/

Good luck... hope your API is out there
my_life:          nop          jmp my_life
[ Keep track of your TDD cycle using "The Death Star" ] [ Verge Video Editor Support Forums ] [ Principles of Verg-o-nomics ] [ "t00t-orials" ]
on the WM_PAINT command
blt the image on the control. it'll take a bit of tweaking but will work.
Well, a custom-draw operation isn't an option. And anyway - I know it can be done without one.


On the subject of what is being passed to create the image list - to wxWidgets - nothing to do with colour depth.

Looking at the source code to wxWidgets itself, the code that creates an image list goes like this:

    UINT flags = 0;    int dd = wxDisplayDepth();    if (dd <= 4)       flags |= ILC_COLOR;   // 16 color    else if (dd <= 8)  flags |= ILC_COLOR8;  // 256 color    else if (dd <= 16) flags |= ILC_COLOR16; // 64k hi-color    else if (dd <= 24) flags |= ILC_COLOR24; // 16m truecolor    else if (dd <= 32) flags |= ILC_COLOR32; // 16m truecolor    m_hImageList = (WXHIMAGELIST) ImageList_Create(width, height, flags,                                                   initial, 1);


And wxDisplayDepth() does this:
ScreenHDC dc;return GetDeviceCaps(dc, PLANES) * GetDeviceCaps(dc, BITSPIXEL);


I will go in there with my debugger and see if the value is different.

This topic is closed to new replies.

Advertisement