Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » CExtBarColorButton::ColorGet problem Collapse All
Subject Author Date
Suhai Gyorgy Oct 5, 2007 - 6:16 AM

Dear Support,

In our non-customizable application we are using a color selection button in the toolbar. I’d like to make the button reflect the currently selected color in its icon. Unfortunately all of your samples which uses the color selection button are customizable, so probably this is the reason you haven’t encountered the problem I have: When the application is non-customizable, CExtBarColorButton::ColorGet is reduced to the following code:
return bSelected ? m_clrDefault : m_clrSelected;

As you can see, this produces the default color when it should produce the selected one. Because of this, OnSyncIcon sets an icon with the default color and not with the selected color, as it should.

Please, check this issue! Thank you!

Technical Support Oct 8, 2007 - 12:58 PM

If you click the color area of a CExtBarColorButton toolbar button, the classic WM_COMMAND message with color button’s identifier will be sent. The command handler method should access the CExtBarColorButton object to get its color value and apply it to something in your project. If you click the drop-down arrow, then the CExtPopupColorMenuWnd color popup menu is displayed and you should handle its notification messages (CExtPopupColorMenuWnd:: g_nMsgNotifyColorChangedFinally).

Technical Support Oct 5, 2007 - 1:42 PM

We confirm this typo in the CExtBarColorButton::ColorGet() method. In fact it should be

COLORREF CExtBarColorButton::ColorGet( bool bSelected ) const
{
      ASSERT_VALID( this );
#if (!defined __EXT_MFC_NO_CUSTOMIZE)
const CExtToolControlBar * pBar = GetBar();
CExtCustomizeCmdTreeNode * pNode = ((CExtBarButton*)this)->GetCmdNode(false);
      if(         pNode != NULL
            &&    pBar->GetSafeHwnd() != NULL
            &&    ::IsWindow( pBar->GetSafeHwnd() )
            )
      {
            ASSERT_VALID( GetBar() );
            ASSERT_VALID( pNode );
            CExtCustomizeSite * pSite =
                  ((CExtToolControlBar *)GetBar())->GetCustomizeSite();
            if( pSite != NULL )
            {
                  COLORREF clr = bSelected ? m_clrSelected : m_clrDefault;
                  if(   pSite->OnColorItemValueGet(
                              (CExtBarColorButton*)this,
                              pNode,
                              clr,
                              bSelected
                              )
                        )
                        return clr;
            } // if( pSite != NULL )
      }
#endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
      return bSelected ? m_clrSelected : m_clrDefault;
}
The CExtBarColorButton toolbar buttons are used in the DRAWCLI sample which is non-customizable in Prof-UIS Freeware.

Suhai Gyorgy Oct 5, 2007 - 3:23 PM

In connection to Color button, whats the default behaviour when user clicks the button with separated dropdown set? In my application, it seems as if it produces a random color, but it could be something specific in my app.