How to setTextColor in DockingDlgInterface Window
I’m currently working on a plugin in C++, and I’m almost finished, but I’m facing a problem.
I’m trying to display a colored text on the panel of the Plugin Window (::DockingDlgInterface) for a status message, but it seems to be impossible.
I have a TextField of type WC_STATIC, and I want to change its color using the WM_CTLCOLORSTATIC event. However, this event doesn’t seem to be triggered. Even if I try to set the color during the window’s initialization (what i just did for testing), it still won’t change. The NPP theme is always dominating the colors.
It would be great if someone could let me know if I’m completely off track or share some tips on how to tackle this. Thxs
I did a quick test of the advice given HERE and it seemed to work in a docking plugin context.
I only tried it in N++'s default theme, because you didn’t indicate which theme might be giving you trouble. With “dark mode” enabled it didn’t set the color; again, not sure if that is the setup you’re asking about because you didn’t say.
EDIT: Ok, I’ll hazard a guess that you were talking about “dark mode”, because in non-dark mode if you choose a different theme from the default, the color scheme from that theme doesn’t change the coloring of anything on the docking dialog.
EDIT: I’m not really sure what the “design plan” is for dark mode and such colors. I suppose it is allowed, as the Find window in dark mode has a color-capable status bar:
Ideally, the plugin programmer could simply ignore dark mode and things would “just work”, but this often doesn’t seem to be the case, here’s another such reference: https://github.com/npp-plugins/plugindemo/issues/4
Alain, You’re correct, I started testing exclusively in Dark Mode and haven’t gotten to Light Mode yet. Your screenshot is exactly what I was trying to achieve… I have avoided diving into NPP’s code until now, as it might be too time-consuming.
Thanks for the useful links and info. I’m eager to test them out and see how they help. However, you have a point - maybe it’s best to ignore color issues for now since Dark Mode doesn’t fully support them yet. And colors are not part of the key functionality.
Also, while implementing, I noticed a couple of bugs related to themes. One is a refreshing problem with comboboxes (not selected lines are pitch black) only in Light Mode (but surprisingly not happening in all Windows installations), and the other is about the color scheme of a disabled list in Dark Mode. I’ll report these on Github.