CXTPScrollBarCtrl for all Controls |
Post Reply |
Author | ||
cpede
Senior Member Joined: 13 August 2004 Location: Denmark Status: Offline Points: 668 |
Post Options
Thanks(0)
Posted: 04 June 2020 at 11:08am |
|
I can see that there exist a CXTPScrollBarCtrl class, which can be themed. However most XT control does not use that control, meaning that scrollbars in e.g. property grids, lists etc are not themed.
How can I use the CXTPScrollBarCtrl in all controls and windows to get my scroll bars themed? Is there a trick to subclass or replace the existing scrollbars?
|
||
Product: Xtreme ToolkitPro (24.0.0)
Platform: Windows 10 (x64) Language: Visual Studio 2017 (C++) |
||
dbrookes
Groupie Joined: 30 August 2019 Location: Australia Status: Offline Points: 70 |
Post Options
Thanks(0)
|
|
Ahh yes... scrollbars... Unfortunately I don't think it's an easy fix. There is some useful information here https://docs.microsoft.com/en-us/windows/win32/controls/about-scroll-bars#standard-scroll-bars-and-scroll-bar-controls. We're currently looking at similar problems in our XTP application. From what I've been looking there are a few options: 1) First disable the inbuilt scrollbar of the control (if its a list box remove WS_VSCROLL style) and second tie the control together with an CXTPScrollBar. I've done this once with a markup list box on a ribbon backstage (which is essentially a dialog) and it seems to work okay (still in testing). In this case the scrollbar is a sibling of the list box and the parent updates its position to be next to the list box and the scrollbar's SCROLLINFO on WM_SIZE. For SCROLLINFO I use the number of visible list box items as the page size and total number of list box items as the max. The parent window implements WM_VSCROLL to handle changes from the CXTPScrollBar. The parent window also hooks the list box window to handle WM_KEYDOWN VK_UP/VK_DOWN and WM_VSCROLL to update the scroll bar. For the list box I use SetTopIndex and GetTopIndex to update to and from the list box. Tree controls are a little different, I haven't had time to look at these yet. Hopefully this is enough of an explanation to try reproduce this and hopefully what I've done isn't terrible. Another idea I had was to wrap the list box in a "scrollbar container" window which moves the clipped child window inside. I think it would allow smooth scrolling which might be nice. I've not tried this though it may be a terrible idea. 2) Set the window theme of the control to take advantage of Windows 10's recently added dark theme.
This should give you a dark themed scroll bar. I've tested this on XTP's tree controls by doing the following patch to CXTPTreeBase::RefreshMetrics...
3) Implement your own versions of common controls. 4) Don't use Win32, ok great. XTP does have a class named CXTPScrollBarContainer which it uses internally for some stuff. I've not been able to figure out how to use it correctly. Help would be appreciated there :) Also, XTP's skin framework does replace these built-in scrollbars somehow. Not sure on the implementation there but from my testing the skin framework doesn't work very well with high DPI scaling. We don't use skin framework in our application. I would also appreciate any help with this :)
|
||
dbrookes
Groupie Joined: 30 August 2019 Location: Australia Status: Offline Points: 70 |
Post Options
Thanks(0)
|
|
Forget everything I said :) v19.2.0 has been released with some stuff for this. I will have to check it out. Thanks XTP.
|
||
cpede
Senior Member Joined: 13 August 2004 Location: Denmark Status: Offline Points: 668 |
Post Options
Thanks(0)
|
|
Yes, it will be interesting to see if they added this to all XTToolkit controls; like PropertyEditor, Report, MarkupScroll, TaskPanel etc. Its all or nothing...
-cpede
|
||
Product: Xtreme ToolkitPro (24.0.0)
Platform: Windows 10 (x64) Language: Visual Studio 2017 (C++) |
||
astoyan
Admin Group Joined: 24 August 2013 Status: Offline Points: 304 |
Post Options
Thanks(0)
|
|
I'm glad to inform you that this issue has finally been addressed in 19.2, and as dbrookes mentioned above, it was quite a tricky task due to the way standard windowless scrollbars are implemented for Windows common controls. GUI_VisualStudio sample demonstrates most of those scroll bars in action. We are aware of some minor issues and it is to be yet added to combo box, so there is some room for improvements. Your feedbacks will help us identify and fix issues faster. Regards, Alexander
|
||
cpede
Senior Member Joined: 13 August 2004 Location: Denmark Status: Offline Points: 668 |
Post Options
Thanks(0)
|
|
Great news I will test.
What about scrollbars in markup <ScrollViewer /> ? -cpede
|
||
Product: Xtreme ToolkitPro (24.0.0)
Platform: Windows 10 (x64) Language: Visual Studio 2017 (C++) |
||
lrenoux
Groupie Joined: 20 April 2009 Status: Offline Points: 62 |
Post Options
Thanks(0)
|
|
I tried but the explanation page for controls deriving from CWnd is slightly succinct and wrong ! Could we have a sample for this specific case ? L. |
||
yangyanhui
Senior Member Joined: 20 August 2020 Status: Offline Points: 131 |
Post Options
Thanks(0)
|
|
how to tie a CXTPEDIT with a CXTPScrollBar? the version of codejock is 17.3.0
|
||
markr
Senior Member Joined: 01 August 2004 Status: Offline Points: 443 |
Post Options
Thanks(0)
|
|
> Set the window theme of the control to take advantage of Windows 10's recently added dark theme. Has anyone found a way to make this option work with markup scrollbars (e.g. ScrollViewer)?
|
||
Pesci7
Groupie Joined: 27 January 2021 Location: Italy Status: Offline Points: 17 |
Post Options
Thanks(0)
|
|
Scollbars in markup are drawn in CXTPMarkupScrollBar::OnRender using CXTPWinThemeWrapper
I have found that you can take advantage of dark theme passing "DarkMode_Explorer::ScrollBar" instead of "SCROLLBAR" (also "Explorer::ScrollBar" is a valid name). You can also pass a list of name "DarkMode_Explorer::ScrollBar;SCROLLBAR" in case dark mode is not supported. What's missing is a way to select light or dark theme using code.
|
||
Product: Xtreme ToolkitPro (22.1.0)
Platform: Windows 11 (x64) Language: Visual Studio 2022 (C++) |
||
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |