Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Controls
  New Posts New Posts RSS Feed - v17 (final) Forgot Theme on CXTPTreeCtrl
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

v17 (final) Forgot Theme on CXTPTreeCtrl

 Post Reply Post Reply
Author
Message
cpede View Drop Down
Senior Member
Senior Member


Joined: 13 August 2004
Location: Denmark
Status: Offline
Points: 668
Post Options Post Options   Thanks (0) Thanks(0)   Quote cpede Quote  Post ReplyReply Direct Link To This Post Topic: v17 (final) Forgot Theme on CXTPTreeCtrl
    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=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++)
Back to Top
cpede View Drop Down
Senior Member
Senior Member


Joined: 13 August 2004
Location: Denmark
Status: Offline
Points: 668
Post Options Post Options   Thanks (0) Thanks(0)   Quote cpede Quote  Post ReplyReply Direct Link To This Post 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++)
Back to Top
cpede View Drop Down
Senior Member
Senior Member


Joined: 13 August 2004
Location: Denmark
Status: Offline
Points: 668
Post Options Post Options   Thanks (0) Thanks(0)   Quote cpede Quote  Post ReplyReply Direct Link To This Post 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++)
Back to Top
Algae View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 January 2007
Location: United States
Status: Offline
Points: 217
Post Options Post Options   Thanks (0) Thanks(0)   Quote Algae Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
cpede View Drop Down
Senior Member
Senior Member


Joined: 13 August 2004
Location: Denmark
Status: Offline
Points: 668
Post Options Post Options   Thanks (0) Thanks(0)   Quote cpede Quote  Post ReplyReply Direct Link To This Post 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++)
Back to Top
Algae View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 January 2007
Location: United States
Status: Offline
Points: 217
Post Options Post Options   Thanks (0) Thanks(0)   Quote Algae Quote  Post ReplyReply Direct Link To This Post 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.


Back to Top
cpede View Drop Down
Senior Member
Senior Member


Joined: 13 August 2004
Location: Denmark
Status: Offline
Points: 668
Post Options Post Options   Thanks (0) Thanks(0)   Quote cpede Quote  Post ReplyReply Direct Link To This Post 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++)
Back to Top
adamg View Drop Down
Groupie
Groupie


Joined: 16 July 2018
Status: Offline
Points: 32
Post Options Post Options   Thanks (0) Thanks(0)   Quote adamg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.141 seconds.