Print Page | Close Window

v17 (final) Forgot Theme on CXTPTreeCtrl

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Controls
Forum Description: Topics Related to Codejock Controls
URL: http://forum.codejock.com/forum_posts.asp?TID=22842
Printed Date: 21 November 2024 at 4:29pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: v17 (final) Forgot Theme on CXTPTreeCtrl
Posted By: cpede
Subject: v17 (final) Forgot Theme on CXTPTreeCtrl
Date Posted: 12 January 2016 at 10:21am
It seems that you have not implemented the WM_XTP_SETCONTROLTHEME message handler for the CXTPTreeCtrl.

This means, that calling:

SendMessageToDescendants(WM_XTP_SETCONTROLTHEME,nTheme);
RedrawWindow(NULL,NULL,RDW_INVALIDATE|RDW_UPDATENOW|RDW_ERASE|RDW_ALLCHILDREN);

as suggested in http://forum.codejock.com/forum_posts.asp?TID=22836&PID=74288&title=one-theme-for-all-controls#74288" rel="nofollow -  http://forum.codejock.com/forum_posts.asp?TID=22836&PID=74283&title=one-theme-for-all-controls#74283  to change the theme globally in the app. does not work.

-cpede


-------------
Product: Xtreme ToolkitPro (24.0.0)
Platform: Windows 10 (x64)
Language: Visual Studio 2017 (C++)



Replies:
Posted By: cpede
Date Posted: 12 January 2016 at 11:00am
And CXTPListView.

And as far as I can see the CXTPListView does not have any code for theming what so ever, CTXTPTreeView contains some?

-cpede


-------------
Product: Xtreme ToolkitPro (24.0.0)
Platform: Windows 10 (x64)
Language: Visual Studio 2017 (C++)


Posted By: cpede
Date Posted: 14 January 2016 at 5:14am
I can see that the CXTPTaskDialog is not themed either :-(

OK, what I'm basically asking is: 

Is this something that you plan to do, - or is it something that you don't want to do?

I don't want to implement this myself, if you plan to do this in an upcoming release.

-cpede


-------------
Product: Xtreme ToolkitPro (24.0.0)
Platform: Windows 10 (x64)
Language: Visual Studio 2017 (C++)


Posted By: Algae
Date Posted: 21 January 2016 at 11:33pm
It's relatively simple to configure yourself. I use the old hack:

ON_WM_SYSCOLORCHANGE()

// in cpp where you set the theme. I use mainframe since it's global:

SendMessageToDescendants(WM_SYSCOLORCHANGE, 0, 0L, TRUE, FALSE);

// When you change a theme, the message is posted to descendants of the mainframe. Each module can respond to the message with something similar to that illustrated below:

// in header
afx_msg void OnSysColorChange();

// in cpp
BEGIN_MESSAGE_MAP
     ON_WM_SYSCOLORCHANGE()

// make a handler using the theme value from wherever you set themes from. Again, mine is stored in mainframe.

void CMyReportView::OnSysColorChange()
{
    GetReportCtrl().SetTheme(((CMainFrame*)AfxGetMainWnd())->GetReportTheme());
    GetReportCtrl().RedrawControl();
}

Unless you use WM_SYSCOLORCHANGE for anything else, you should be good to go.

Unfortunately, there is no "one theme fits all" integrated method for all controls. It becomes problematic if you want some things to use a common theme and other things you don't - perhaps it requires something like a "theme override" byte for each control? That's how I'd do it Big smile

The current CJ method offers more flexibility but makes it more difficult to create a single pattern for changing themes.


Posted By: cpede
Date Posted: 22 January 2016 at 1:46am
My original question was regarding the difference in the CXTPTreeCtrlView and the CXTPListCtrlView regarding themes.

It is somehow possible to theme the CXTPTreeCtrlView, but there is no code for theming the CXTPListCtrlView.

I am aware of the conflict between theming (and skinning) controls, and then the general Windows styles, but I think that this should be up to the programmer to decide. Sometimes (maybe even often) a CXTPTreeCtrlView or CXTPListCtrlView is used in a prominent place in an application, and therefore it would be logical to apply a local theme to it.

-cpede


-------------
Product: Xtreme ToolkitPro (24.0.0)
Platform: Windows 10 (x64)
Language: Visual Studio 2017 (C++)


Posted By: Algae
Date Posted: 22 January 2016 at 1:53pm
Hello cpede -

Sorry, perhaps I didn't understand your question. I don't know if v. 17 has the same capability as the v. 16.26 I'm using, but it has been possible to theme the header of a CXTPListCtrl for some time. As shown:

// xtpControlThemeResource is an XTPControlTheme enum. Any of the enums should work.

bool MyListCtrl::Init()
{
    CXTPListCtrl::Init();
    HWND hWndHeader = GetDlgItem(0)->GetSafeHwnd();
    m_header.SubclassWindow(hWndHeader);
    m_header.EnablePopupMenus(TRUE);
    m_header.SetTheme(xtpControlThemeResource);
    return true;
}

I agree the developer should be able to choose when and where to apply themes/skins.




Posted By: cpede
Date Posted: 23 January 2016 at 4:27am
I'm talking about the standard CXTPListCtrl (a list of items), and the CXTPTreeCtrl (a list of items with different levels). I know that these are inherited directly from the MFC versions, and normally these are using the Windows colors selected.

But since most other controls, button, combo boxes, edit etc. in the XTToolkit are themed, I find it strange that the lists above are not fully themed. Nothing more than that.

-cpede


-------------
Product: Xtreme ToolkitPro (24.0.0)
Platform: Windows 10 (x64)
Language: Visual Studio 2017 (C++)


Posted By: adamg
Date Posted: 26 August 2019 at 6:08pm
how have you solved the problem with themes?
how do you solve the issues with not themed scrollbars?

Adam



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net