Native windows system theme for tree control
Posted: Wed Jun 14, 2017 8:57 pm
I'm a happy user of the Codelite IDE for developing a cross platform application with wxWidgets. When using the wxTreeCrtl I get on windows the more old fashioned style with the + and minus and the dotted lines. I tried to use the more modern style by usingthe wxTR_TWIST_BUTTONS style. I tried to call the 'EnableSystemTheme()' method on the control, but all in vain.
When using the Codelite IDE, which also using wxWidgets on windows, the trees do have the more modern look. So I cloned the Git repository of Codelite and looked in the source files on how it is done there.
There I extracted the following piece of code:
[/color]
And after constructing the tree control I pass its pointer to this function. I even used the debugger to check the return code of SetWindowTheme which was 0, so that seems ok, but still all looks the same old way.
Since it does seem to work in Codelite, the question is, what do I miss? Must there be some mystic initialisation call?
I use wxWidgets 3.1 and applied 3 patches on it that i found with "brew edit wxMac"
I further build the wxWidgets sources for the 3 platforms with the settings as mentioned on the Codelite Wiki about how to build Codelite. I assumed that if that it is good for building Codelite, it is also good for my application.
Thus any hints on how to get the modern look on tree control under windows are welkom.
I can not stress the good work of Codelite, it is a real gem!
When using the Codelite IDE, which also using wxWidgets on windows, the trees do have the more modern look. So I cloned the Git repository of Codelite and looked in the source files on how it is done there.
There I extracted the following piece of code:
Code: Select all
#ifdef __WXMSW__
#include <Uxtheme.h>
#endif
void MSWSetNativeTheme(wxWindow* win, const wxString& theme = wxT("Explorer"))
{
#ifdef __WXMSW__
SetWindowTheme((HWND)win->GetHWND(), theme.c_str(), NULL);
#endif
}
And after constructing the tree control I pass its pointer to this function. I even used the debugger to check the return code of SetWindowTheme which was 0, so that seems ok, but still all looks the same old way.
Since it does seem to work in Codelite, the question is, what do I miss? Must there be some mystic initialisation call?
I use wxWidgets 3.1 and applied 3 patches on it that i found with "brew edit wxMac"
I further build the wxWidgets sources for the 3 platforms with the settings as mentioned on the Codelite Wiki about how to build Codelite. I assumed that if that it is good for building Codelite, it is also good for my application.
Thus any hints on how to get the modern look on tree control under windows are welkom.
I can not stress the good work of Codelite, it is a real gem!