![]() |
Painting of disabled toolbar button |
Post Reply ![]() |
Author | |
akur ![]() Senior Member ![]() Joined: 16 May 2006 Status: Offline Points: 139 |
![]() ![]() ![]() ![]() ![]() Posted: 16 January 2007 at 2:07am |
Hello,
I use the icon in 1st pic in my toolbar button, which - when disabled - was correctly grayed by XTP as on the 2nd pic in v10.1. However, with v10.4, I get a bad look for the same grayed button (see 3rd pic). (Images are zoomed) This is how I add this toolbar button (using the same code in both versions v10.1 and v10.4): CXTPControlButton *pButton = new CXTPControlButton(); pButton->SetID( nMyButtonId ); pButton->SetCustomIcon( hMyIcon ); pButton->SetStyle(xtpButtonIconAndCaptionBelow); m_pToolbar->GetControls()->Add(pButton); (Disabling of buttons is accomplished by cmd update handlers.) Where do you think the problem lies? Why is the shadow differently rendered to gray suddenly? Thank you, in advance! |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi,
try to switch these falgs:
XTPPaintManager()->GetIconsInfo()->bUseDisabledIcons
XTPPaintManager()->GetIconsInfo()->bOfficeStyleDisabledIcons
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
akur ![]() Senior Member ![]() Joined: 16 May 2006 Status: Offline Points: 139 |
![]() ![]() ![]() ![]() ![]() |
Thank you, it's much better now.
But it's still not the same for some other icons of mine. Eg. from the enabled icon on the left, I get a bad looking disabled icon on the right: By the way, is there a way to force XTP to use my own versions of disabled, greyed icons? I'm trying to use this code to achieve it:
UINT nCustomIconId =
m_pToolbar->GetImageManager()->AddCustomIcon(CXTPImageManagerIconHandle(hMyIcon)); Thank you, in advance! |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi, Don't use AddCustomIcon,
Use standard SetIcons for normal and disabled icons.
For example:
// pCommandBars->GetImageManager()->SetIcons(IDR_MAINFRAME, xtpImageNormal);// pCommandBars->GetImageManager()->SetIcons(IDR_MAINFRAME, IDR_MAINFRAME_DISABLED, xtpImageDisabled); |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
akur ![]() Senior Member ![]() Joined: 16 May 2006 Status: Offline Points: 139 |
![]() ![]() ![]() ![]() ![]() |
Thank you oleg, but unfortunately this still doesn't work. I've tried the CImageList-based version of SetIcons() (because we don't have fixed, resource-based toolbars), but the disabled images are too dark grey, again.
![]() So finally I ended up with overloading CXTPPaintManager::DrawImage() to execute my own code for drawing disabled buttons. Just for the information of those who may be interested. Anyway, thank you for your help. |
|
![]() |
|
wimix ![]() Newbie ![]() Joined: 13 March 2007 Location: Germany Status: Offline Points: 2 |
![]() ![]() ![]() ![]() ![]() |
Hi!
I've got a similar problem with disabled icons but I use the standard SetIcons functions. m_pDocBar->LoadToolBar(IDR_TOOLBAR_DOC); m_pDocBar->SetIconSize(CSize(24,24)); m_pDocBar->GetImageManager()->SetIcons(IDR_TOOLBAR_DOC, IDB_TOOLBAR_DOC, xtpImageNormal); m_pDocBar->GetImageManager()->SetIcons(IDR_TOOLBAR_DOC, IDB_TOOLBAR_DOC_DISABLED, xtpImageDisabled); The disabled icons are not used. For testing, I added the disabled icons as hot icons too. They are displayed correctly (=disabled icon) when the mouse is over the buttons. m_pDocBar->GetImageManager()->SetIcons(IDR_TOOLBAR_DOC, IDB_TOOLBAR_DOC_DISABLED, xtpImageHot); Correct enabled icon but wrong disabled icon: For testing: disabled icon in hot state: The main window is derived from CXTPFrameWnd. It's embedded as a child window in a Windows Explorer tool bar. Does somebody have an idea? Regards |
|
![]() |
|
akur ![]() Senior Member ![]() Joined: 16 May 2006 Status: Offline Points: 139 |
![]() ![]() ![]() ![]() ![]() |
Hello,
just an idea: did you try to play a little bit with the flags Oleg has told about above? I mean setting/resetting these:
XTPPaintManager()->GetIconsInfo()->bUseDisabledIcons
XTPPaintManager()->GetIconsInfo()->bOfficeStyleDisabledIcons
|
|
![]() |
|
wimix ![]() Newbie ![]() Joined: 13 March 2007 Location: Germany Status: Offline Points: 2 |
![]() ![]() ![]() ![]() ![]() |
Thank you, akur! Now, it works fine.
I picked the usage of disabled images from the GUI_MsMoney example. It does not set bUseDisabledIcons, so I thought I don't need it too. |
|
![]() |
|
akur ![]() Senior Member ![]() Joined: 16 May 2006 Status: Offline Points: 139 |
![]() ![]() ![]() ![]() ![]() |
I'm glad that it helped you.
|
|
![]() |
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 |