Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Slider on Gradient Toolbar
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Slider on Gradient Toolbar

 Post Reply Post Reply
Author
Message
Ark42 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 20 October 2003
Status: Offline
Points: 291
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ark42 Quote  Post ReplyReply Direct Link To This Post Topic: Slider on Gradient Toolbar
    Posted: 07 February 2005 at 8:43pm
Ok, well I finally got it working, and its a lot of hackish looking code probably, but you CAN have sliders on the toolbars, with gradient backgrounds showing thru and all. They work perfectly, even with customization drawing the border on top of it.  I put in a sunken 3D border for when it has focus instead of the dotted outline it normally would get. They work in menus and don't have to close the menu when used either. And of course, it works with other themes other than the Office 2003 (extended) theme too.





I forgot and took the screenshots on Windows 2000, but it works with the XP slider too:




Edited by Ark42
Back to Top
Ark42 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 20 October 2003
Status: Offline
Points: 291
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ark42 Quote  Post ReplyReply Direct Link To This Post Posted: 07 February 2005 at 8:50pm

The code involves firstly a custom implementation of a memory DC. You must use TransparentBlt instead of BitBlt, which means you need to target 98/ME/2000/XP (no 95/NT) or at least LoadLibrary msimg32 and get TransparentBlt that way if you want a fallback.

The slider's dummy parent will respond to WM_CTLCOLORSTATIC and set the background brush to a solid key color, used for your TransparentBlt.  I use 255,16,255 because its a bright purple nobody should really want anyways.

Your control derived from CSliderCtrl needs to use the memory DC with the TransparentBlt. I set its OnPaint handler to GetCurrentMessage and use the HDC provided in the wParam parameter, and if no HDC is provided, it will instead tell the parent to redraw, and respond with a dummy CPaintDC setup and no drawing.  If it does have a HDC provided, it sets up the memory DC and calls DefWindowProc with it. Make sure you added WS_EX_TRANSPARENT to the control derived from CSliderCtrl so the background shows through.

The last trick is that in your control derived from CXTPControlCustom, you need to override Draw(), adjust the viewport origin with m_rcControl, and send WM_PAINT to the CSliderCtrl derived control with the HDC provided to Draw(). Make sure to restore the viewport origin after the sendmessage call.
Seems like lots of funny hacks to get it to work, and I don't want to paste all the tons of code for it, but its definately possible to do!



Edited by Ark42
Back to Top
mjm_d View Drop Down
Newbie
Newbie


Joined: 20 September 2005
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote mjm_d Quote  Post ReplyReply Direct Link To This Post Posted: 13 November 2005 at 11:26pm
you can see the Sample "CommonControls"
Back to Top
Ark42 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 20 October 2003
Status: Offline
Points: 291
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ark42 Quote  Post ReplyReply Direct Link To This Post Posted: 13 November 2005 at 11:31pm
Unless something has changed, no, that sample never worked for anything other than the office 2000 theme with solid color backgrounds.

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 11 March 2006 at 8:22pm

ok... here my small sample:

2006-03-11_202053_SliderSample.zip

ps. tested with winxp only...

 

 

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Ark42 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 20 October 2003
Status: Offline
Points: 291
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ark42 Quote  Post ReplyReply Direct Link To This Post Posted: 12 March 2006 at 9:56am
Was the GetParent()->Print(pDC, PRF_CLIENT); in CXTPControlSliderCtrl::CtlColor in your sample a feature added to a new version of CodeJock recently? I recall trying to get something a little simpler like that to work in the past but could not find a way to properly derive the controls to set up the painting like that. So before, I was forced to use a TransparentBlt, but this way looks cleaner and safer for Win95/98.
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 12 March 2006 at 11:11am
yes, WM_PRINT support was added in 9.80 version only...
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Ark42 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 20 October 2003
Status: Offline
Points: 291
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ark42 Quote  Post ReplyReply Direct Link To This Post Posted: 12 March 2006 at 11:14am

Thats great, I might have to redo mine classes using that. I also like how yours are resizable too, that must be another new feature in 9.80+?

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 12 March 2006 at 7:14pm

Hello,

Actually resizeable feature and inteface was added in 9.60 :)

from Release Notes:

Added ability to resize ComboBox and Edit controls by user in Customize mode

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Ark42 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 20 October 2003
Status: Offline
Points: 291
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ark42 Quote  Post ReplyReply Direct Link To This Post Posted: 13 March 2006 at 10:17am

Wow, I didn't even notice that for some reason.  When you resize a combobox, the is the dropdown part supposed to be resized as well? It seems to stay the original width. Doesn't really matter though, since its already a bonus mini-feature in my program now, I didn't know they where even resizable.

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 13 March 2006 at 5:50pm

Hello,

It will resize automatically if you don't set it to some static value.

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
lorax1284 View Drop Down
Groupie
Groupie
Avatar

Joined: 10 September 2005
Location: Canada
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote lorax1284 Quote  Post ReplyReply Direct Link To This Post Posted: 29 July 2006 at 1:06am
Hello; I have this code downloaded and it gets the "AboutDlg" bits included and compiled in alright (or so I believe) but I get a whole pile of these:

CXTPControl::GetAccessibleName(struct tagVARIANT,unsigned short * *)" (?GetAccessibleName@CXTPControl@@MAEJUtagVARIANT@@PAPAG@Z)
XTPControlSlider.obj : error LNK2001: unresolved external symbol "protected: virtual long __thiscall CXTPControl::GetAccessibleName(struct tagVARIANT,unsigned short * *)" (?GetAccessibleName@CXTPControl@@MAEJUtagVARIANT@@PAPAG@Z)


Is there any way to fix this? It took quite a bit of work to get to this point, too... is there documentation someone could point me at, for properly locating downloaded code samples on my file system so they'll compile?

Thanks
Ryan Germann
Product Manager &
UI Designer
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 29 July 2006 at 12:31pm
Hi,
 
Change this option:
 
Configuration Properties->C/C++->Language->Treat wchar_t as Builtin Type = Yes.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
lorax1284 View Drop Down
Groupie
Groupie
Avatar

Joined: 10 September 2005
Location: Canada
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote lorax1284 Quote  Post ReplyReply Direct Link To This Post Posted: 29 July 2006 at 5:23pm
Thanks; that did the trick.

I noticed there is a .bmp file: ToolbarVolume.bmp

Is that a mask file that is required to make the skin show through? I'm pretty sure we're not using a mask of any kind.

Thanks
Ryan Germann
Product Manager &
UI Designer
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 31 July 2006 at 8:18am
Hello,
 
I can't download attachment.. seems it was lost when we changed forum engine. Can you upload it again?
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
lorax1284 View Drop Down
Groupie
Groupie
Avatar

Joined: 10 September 2005
Location: Canada
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote lorax1284 Quote  Post ReplyReply Direct Link To This Post Posted: 08 August 2006 at 11:17pm
uploads/20060808_230916_20060712_100956.zip

Sorry Oleg; I misunderstood that you wanted me to upload it... here it is.

Incidentally, that slider sample shows the CodeJock "skin" applied to a slider on a toolbar, but the problem I need to solve is that the slider on the toolbar is not adopting the WindowBlinds skin.

Also, there seems to be a raised "tablet" area around all of the buttons and the slider that are on toolbars, which I'd like do to away with.

I've attached a screenshot, enlarged to show detail, and I've filled the areas that show up as "silver" with Magenta to make them stand out... they are just grey on my GUI, but I want them to basically be transparent so the skin will show through.

Thanks


Ryan Germann
Product Manager &
UI Designer
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 14 August 2006 at 9:37am
Hi,
Question was how to use Office 2003 theme + Slider... but seems it is WinXP theme... If you use WinXP you don't need all this code in CtlColor
just comment handlers.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
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.188 seconds.