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 General Discussion » Changing icon through customization Collapse All
Subject Author Date
anil vyas Jul 2, 2007 - 5:11 AM

Hi,
1.I want to change icon of toolbar throgh customization built in icons.When customization dialog box is open I right click on toolbar button then through menu i want to change icon.But it works fine with Debug version.If i try to do same on Release version.I cann’t.I have tried the same in sample application also.But it doesn’t work there also.
2.I want to include my own icons in this icon list.Is it possible.
3.When i use edit icon it works fine in both Debug and Release version also.Can i have color palatte also in edit icon dialog box.
Waiting for your early reply.

anil vyas Jul 4, 2007 - 3:41 AM

Hi.
Thanks.I got solution .But I have another problem related to customization
1.I want to insert Image list through CImageList In My customization ComboBox Of my toolbar.How is it possible?
2.I have two combobox.I want to make my one combo non-editable also.
3.I want to insert toolbar dynamically.In this i am inserting button dynamically .I want this toolbar Name not to appear in customization listbox when it is open.How is it possible?

Technical Support Jul 4, 2007 - 10:28 AM

The toolbars and menus in customizable applications are based on CExtCustomizeCmdTreeNode command tree nodes. To remove the in-place editor, you can apply the __ECTN_TBB_TF_NE style to a text field/combo box field command tree node by using CExtCustomizeCmdTreeNode::ModifyFlags().

Suhai Gyorgy Jul 4, 2007 - 4:06 AM

There’s a property for this:
CExtToolControlBar::m_bCustomizationAllowed
If set to true, the toolbar can be customized; otherwise, it cannot be customized.

Technical Support Jul 2, 2007 - 9:13 AM

We confirm the problem with changing icons in the release mode. You can fix this by updating the source code for the CExtCustomizeSite::OnCustomizeTreeNode() virtual method in the ../Prof-UIS/Src/ExtCustomize.cpp file listed at the end of this message. You can also override this method if you want to modify anything related to the context menu displayed over toolbar buttons and menu items in the customize mode. If you want to change the icons palette only, then you should override the CExtCustomizeSite::OnGetCustomizedNodeIconPaletteInfo() virtual method.

Here is the source code of the CExtCustomizeSite::OnCustomizeTreeNode() virtual method:

bool CExtCustomizeSite::OnCustomizeTreeNode(
      CExtCustomizeCmdTreeNode * pNodeI,
      CExtCustomizeCmdTreeNode * pNodeC,
      CExtCmdItem * pCmdItem,
      bool & bDelete,
      bool bCanAddRemoveSeparator,
      CObject * pObjEventSrc
      )
{
      ASSERT( this != NULL );
#ifdef _DEBUG
      if( pNodeI != NULL )
      {
            ASSERT_VALID( pNodeI );
      }
#endif // _DEBUG
      ASSERT_VALID( pNodeC );
      ASSERT( pCmdItem != NULL );
      ASSERT( m_bInitComplete );
CWnd * pWndTop = GetCustomizeTopWnd();
      ASSERT_VALID( pWndTop );
      ASSERT( pWndTop->GetSafeHwnd() != NULL && ::IsWindow(pWndTop->GetSafeHwnd()) );
      ASSERT( m_hWndCustomizeForm != NULL && ::IsWindow(m_hWndCustomizeForm) );
      ASSERT_VALID( pObjEventSrc );

      if(         pNodeI == NULL
            &&    (pNodeC->GetFlags() & __ECTN_DYNAMIC_POPUP)
            )
      {
            pNodeI =
                  FindDynamicPopupInitialState(
                        pNodeC->GetCmdID( false )
                        );
#ifdef _DEBUG
            if( pNodeI != NULL )
            {
                  ASSERT_VALID( pNodeI );
            }
#endif // _DEBUG
      } // if( pNodeI == NULL ...

CExtSafeString strProfileName =
            g_CmdManager->ProfileNameFromWnd( pWndTop->m_hWnd );
      ASSERT( !strProfileName.IsEmpty() );
      if( ! g_CmdManager->UpdateFromMenu(
                  strProfileName,
                  IDR_MENU_CUSTOMIZE_BTN,
                  true
                  )
            )
      {
            ASSERT( FALSE );
            return false;
      }
CExtPopupMenuWnd * pPopup = new CExtPopupMenuWnd;
      { // BLOCK
            if( !pPopup->LoadMenu(
                        m_hWndCustomizeForm,
                        IDR_MENU_CUSTOMIZE_BTN
                        )
                  )
            {
                  ASSERT( FALSE );
                  delete pPopup;
                  return false;
            }
      } // BLOCK
CExtCmdIcon _iconPasteFromClipBoard, * pIconCurrent = NULL;
bool bCanChangeDisplayStyle = pNodeC->CanChangeDisplayStyle( pCmdItem );
bool bCanChangeIcon =
            (     (!  pCmdItem->StateIsPersistentIcon() )
                  && (pNodeC->GetFlags()&__ECTN_TBB_AUTOCHANGE_ID) == 0
            ) ? true : false
            ;
      if( ! bCanChangeDisplayStyle )
      {
            pPopup->ItemGetInfo(pPopup->ItemFindPosForCmdID(ID_EXT_BTN_IMAGE_COPY)).Enable(false);
            pPopup->ItemGetInfo(pPopup->ItemFindPosForCmdID(ID_EXT_BTN_IMAGE_PASTE)).Enable(false);
            pPopup->ItemGetInfo(pPopup->ItemFindPosForCmdID(ID_EXT_BTN_IMAGE_EDIT)).Enable(false);
            pPopup->ItemGetInfo(pPopup->ItemFindPosForCmdID(ID_EXT_BTN_IMAGE_CHANGE)).Enable(false);
            pPopup->ItemGetInfo(pPopup->ItemFindPosForCmdID(ID_EXT_BTN_IMAGE_RESET)).Enable(false);
            pPopup->ItemGetInfo(pPopup->ItemFindPosForCmdID(ID_EXT_BTN_STYLE_DEFAULT)).Enable(false);
            pPopup->ItemGetInfo(pPopup->ItemFindPosForCmdID(ID_EXT_BTN_STYLE_IMAGE_AND_TEXT)).Enable(false);
            pPopup->ItemGetInfo(pPopup->ItemFindPosForCmdID(ID_EXT_BTN_STYLE_TEXT_ONLY_ALWAYS)).Enable(false);
            pPopup->ItemGetInfo(pPopup->ItemFindPosForCmdID(ID_EXT_BTN_STYLE_TEXT_ONLY_IN_MENUS)).Enable(false);
      } // if( ! bCanChangeDisplayStyle )
      else if( bCanChangeIcon )
      {
            pIconCurrent = pNodeC->CurrentIconGetPtr( true, pCmdItem );
            CExtCmdIcon * pIcon = pNodeC->GetIconPtrInToolbar( pCmdItem, true );
            if(         (     ::IsClipboardFormatAvailable( CF_BITMAP )
                        ||    ::IsClipboardFormatAvailable( CF_DIB )
                        )
                  &&    pIcon != NULL
                  &&    (! pIcon->IsEmpty() )
                  &&    ::OpenClipboard( m_hWndCustomizeForm )
                  )
            {
                  CSize _sizeOriginal( pIcon->GetSize() );
                  ASSERT( _sizeOriginal.cx > 0 && _sizeOriginal.cy > 0 );
                  HBITMAP hBmpClipboard = (HBITMAP)
                        ::GetClipboardData( CF_BITMAP );
                  if( hBmpClipboard != NULL )
                  {
                        BITMAP bmpInfo;
                        ::memset( &bmpInfo, 0, sizeof(BITMAP) );
                        ::GetObject( hBmpClipboard, sizeof(BITMAP), &bmpInfo );
                        ASSERT( bmpInfo.bmWidth > 0 && bmpInfo.bmHeight > 0 );
                        if(         bmpInfo.bmWidth >= _sizeOriginal.cx
                              &&    bmpInfo.bmHeight >= _sizeOriginal.cy
                              )
                        {
                              COLORREF clrTransparent = RGB( 255, 0, 255 ); // may be, default for MFC
//                            if( pIcon->IsBitmapBased() )
//                                  clrTransparent = pIcon->GetBitmapTransparentColor();
                              CRect rcExtract( 0, 0, _sizeOriginal.cx, _sizeOriginal.cy );
                              _iconPasteFromClipBoard.AssignFromHBITMAP(
                                    hBmpClipboard,
                                    clrTransparent,
                                    &rcExtract
                                    );
                        }
                  } // if( hBmpClipboard != NULL )
                  ::CloseClipboard();
            }
            if( _iconPasteFromClipBoard.IsEmpty() )
                  pPopup->ItemGetInfo(pPopup->ItemFindPosForCmdID(ID_EXT_BTN_IMAGE_PASTE)).Enable(false);
            if( pIconCurrent == NULL )
                  pPopup->ItemGetInfo(pPopup->ItemFindPosForCmdID(ID_EXT_BTN_IMAGE_COPY)).Enable(false);
      } // else if( bCanChangeIcon )

      if( bCanChangeIcon )
      {
            if( pCmdItem->StateIsPersistentIcon() )
                  bCanChangeIcon = false;
      } // if( bCanChangeIcon )

      if( ! bCanChangeIcon )
      {
            pPopup->ItemGetInfo(pPopup->ItemFindPosForCmdID(ID_EXT_BTN_IMAGE_COPY)).Enable(false);
            pPopup->ItemGetInfo(pPopup->ItemFindPosForCmdID(ID_EXT_BTN_IMAGE_PASTE)).Enable(false);
            pPopup->ItemGetInfo(pPopup->ItemFindPosForCmdID(ID_EXT_BTN_IMAGE_EDIT)).Enable(false);
            pPopup->ItemGetInfo(pPopup->ItemFindPosForCmdID(ID_EXT_BTN_IMAGE_CHANGE)).Enable(false);
            pPopup->ItemGetInfo(pPopup->ItemFindPosForCmdID(ID_EXT_BTN_IMAGE_RESET)).Enable(false);
      } // if( ! bCanChangeIcon )

      if( ! bCanAddRemoveSeparator )
            pPopup->ItemGetInfo(
                  pPopup->ItemFindPosForCmdID(ID_EXT_BTN_BEGIN_A_GROUP)
                  ).Enable(false);

      switch( (pNodeC->GetFlags() & __ECTN_DISPLAY_MASK) )
      {
      case __ECTN_DISPLAY_DEFAULT_STYLE:
            pPopup->ItemGetInfo(pPopup->ItemFindPosForCmdID(ID_EXT_BTN_STYLE_DEFAULT)).Check(true);
            break;
      case __ECTN_DISPLAY_TEXT_AND_IMAGE:
            pPopup->ItemGetInfo(pPopup->ItemFindPosForCmdID(ID_EXT_BTN_STYLE_IMAGE_AND_TEXT)).Check(true);
            break;
      case __ECTN_DISPLAY_TEXTONLY_ALWAYS:
            pPopup->ItemGetInfo(pPopup->ItemFindPosForCmdID(ID_EXT_BTN_STYLE_TEXT_ONLY_ALWAYS)).Check(true);
            break;
      case __ECTN_DISPLAY_TEXTONLY_IN_MENU:
            pPopup->ItemGetInfo(pPopup->ItemFindPosForCmdID(ID_EXT_BTN_STYLE_TEXT_ONLY_IN_MENUS)).Check(true);
            break;
      } // switch( (pNodeC->GetFlags() & __ECTN_DISPLAY_MASK) )

      if( (pNodeC->GetFlags() & __ECTN_GROUP_START) )
            pPopup->ItemGetInfo(pPopup->ItemFindPosForCmdID(ID_EXT_BTN_BEGIN_A_GROUP)).Check(true);

bool bEditMenuText = true;
      if(         pObjEventSrc->IsKindOf(RUNTIME_CLASS(CExtToolControlBar))
            ||    pObjEventSrc->IsKindOf(RUNTIME_CLASS(CExtBarButton))
            )
            bEditMenuText = false;
CExtSafeString strTextToEditInPlace =
            bEditMenuText
                  ? pNodeC->GetTextInMenu( pCmdItem, true )
                  : pNodeC->GetTextInToolbar( pCmdItem, true )
                  ;
CExtSafeString strTextOriginal( strTextToEditInPlace );
      pPopup->ItemGetInfo(
            pPopup->ItemFindPosForCmdID(ID_EXT_BTN_NAME)).
                  SetInplaceEdit( &strTextToEditInPlace );

UINT nIdIconPaletteFirst = 0;
CExtBitmap _bmpPalette;
SIZE sizePaletteDimension = { 0, 0 };
SIZE sizeBitmapPart = { 0, 0 };
COLORREF clrTransparent = RGB(0,0,0);

#if (defined __EXT_MFC_NO_ICONEDITDLG)
      pPopup->ItemRemove(
            pPopup->ItemFindPosForCmdID( ID_EXT_BTN_IMAGE_EDIT )
            );
      pPopup->ItemRemove(
            pPopup->ItemFindPosForCmdID( ID_EXT_BTN_IMAGE_CHANGE )
            );
#else // (defined __EXT_MFC_NO_ICONEDITDLG)
      if( bCanChangeDisplayStyle && bCanChangeIcon )
      {
            OnGetCustomizedNodeIconPaletteInfo(
                  pNodeI,
                  pNodeC,
                  pCmdItem,
                  pObjEventSrc,
                  nIdIconPaletteFirst,
                  _bmpPalette,
                  sizePaletteDimension,
                  sizeBitmapPart,
                  clrTransparent
                  );
            if(         ( ! _bmpPalette.IsEmpty() )
                  &&    sizePaletteDimension.cx > 0
                  &&    sizePaletteDimension.cy > 0
                  &&    sizeBitmapPart.cx > 0
                  &&    sizeBitmapPart.cy > 0
                  &&    nIdIconPaletteFirst > 0
                  )
            {
                  INT nReplacePos = pPopup->ItemFindPosForCmdID( ID_EXT_BTN_IMAGE_CHANGE );
                  ASSERT( nReplacePos >= 0 );
                  pPopup->ItemRemove( nReplacePos );
                  CExtPopupMenuWnd * pPalettePopup = new CExtPopupMenuWnd;
                  pPopup->ItemInsertSpecPopup(
                        pPalettePopup,
                        nReplacePos,
                        g_CmdManager->CmdGetPtr(
                              g_CmdManager->ProfileNameFromWnd( m_hWndCustomizeForm ),
                              ID_EXT_BTN_IMAGE_CHANGE
                              )->m_sMenuText
                        );
                  pPalettePopup->TrackFlagsSet(
                        pPalettePopup->TrackFlagsGet()
                        | TPMX_PALETTE
                        );
                  INT nRow, nColumn;
                  for( nRow = 0; nRow < sizePaletteDimension.cy; nRow ++ )
                  {
                        for( nColumn = 0; nColumn < sizePaletteDimension.cx; nColumn ++ )
                        {
                              CPoint ptBitmapOffset(
                                    nRow * sizePaletteDimension.cx * sizeBitmapPart.cx
                                          + nColumn * sizeBitmapPart.cx,
                                    0
                                    );
                              CRect rcBitmapPart(
                                    ptBitmapOffset,
                                    sizeBitmapPart
                                    );
                              CExtCmdIcon _icon;
                              _icon.m_bmpNormal.FromBitmap(
                                    _bmpPalette,
                                    &rcBitmapPart
                                    );
                              ASSERT( !_icon.IsEmpty() );
                              if( clrTransparent != COLORREF(-1L) )
                                    _icon.m_bmpNormal.AlphaColor( clrTransparent, RGB(0,0,0), 0 );
                              pPalettePopup->ItemInsertCommand(
                                    nIdIconPaletteFirst + nRow*sizePaletteDimension.cx + nColumn,
                                    -1,
                                    NULL,
                                    NULL,
                                    _icon
                                    );
                              if( nColumn == (sizePaletteDimension.cx-1) )
                                    pPalettePopup->ItemPaletteRowWrapSet(
                                          pPalettePopup->ItemGetCount() - 1
                                          );
                        } // for( nColumn = 0; nColumn < sizePaletteDimension.cx; nColumn ++ )
                  } // for( nRow = 0; nRow < sizePaletteDimension.cy; nRow ++ )
            } // if( hBitmap != NULL ...
      } // if( bCanChangeDisplayStyle && bCanChangeIcon )
#endif // else from (defined __EXT_MFC_NO_ICONEDITDLG)

      if( !bEditMenuText )
            ::SetForegroundWindow( m_hWndCustomizeForm );
CPoint ptCursor;
      if( ! ::GetCursorPos(&ptCursor) )
      {
            delete pPopup;
            return false;
      }
UINT nCmdRetVal = 0;
      ::SetTimer( m_hWndCustomizeForm, 0x800, 50, NULL );
BOOL bTrackResult =
            pPopup->TrackPopupMenu(
                  TPMX_COMBINE_NONE|TPMX_DO_MESSAGE_LOOP
                        |TPMX_NO_WM_COMMAND|TPMX_NO_CMD_UI
                        |TPMX_NO_HIDE_RARELY,
                  ptCursor.x, ptCursor.y,
                  NULL, NULL, NULL,
                  &nCmdRetVal
                  );
      ::KillTimer( m_hWndCustomizeForm, 0x800 );
      if( ! bTrackResult )
      {
            ASSERT( FALSE );
            delete pPopup;
            return false;
      }

bool bTextChanged =
            ( strTextToEditInPlace != strTextOriginal )
                  ? true : false;

      if( nCmdRetVal == 0 && (!bTextChanged) )
            return false;

      if( bTextChanged )
      {
            if( bEditMenuText )
                  pNodeC->SetTextInMenu(
                        strTextToEditInPlace.IsEmpty()
                              ? _T("")
                              : strTextToEditInPlace
                        );
            else
                  pNodeC->SetTextInToolbar(
                        strTextToEditInPlace.IsEmpty()
                              ? _T("")
                              : strTextToEditInPlace
                        );
      } // if( bTextChanged )

      switch( nCmdRetVal )
      {
      case 0:
            return bTextChanged;
      case ID_EXT_BTN_RESET:
            if( pNodeI != NULL )
            {
                  if(         (! pObjEventSrc->IsKindOf(RUNTIME_CLASS(CExtPopupMenuWnd)) )
                        ||    ((CExtPopupMenuWnd*)pObjEventSrc)->GetSafeHwnd() == NULL
                        )
                        DropTargetPopupCancelEx( -2 );
                  (*pNodeC) = (*pNodeI);
            }
            else
            {
                  pNodeC->AssignCmdProps( pCmdItem );
                  pNodeC->ModifyFlags( 0, __ECTN_DISPLAY_MASK );
                  pNodeC->ModifyFlags( __ECTN_DISPLAY_DEFAULT_STYLE );
            } // else from if( pNodeI != NULL )
            RedrawCommandItems( pNodeC->GetCmdID( false ) );
            return true;
      case ID_EXT_BTN_DELETE:
            bDelete = true;
            return true;
      case ID_EXT_BTN_IMAGE_COPY:
      {
            ASSERT( bCanChangeDisplayStyle );
            ASSERT( pIconCurrent != NULL );
            if( pIconCurrent->IsEmpty() )
            {
                  pIconCurrent = pNodeC->GetIconPtrInToolbar( pCmdItem, false );
                  ASSERT( !pIconCurrent->IsEmpty() );
            }
            HBITMAP hBmpCopy = NULL;
            COLORREF clrTransparent = RGB( 0, 0, 0 );
            if(         (! pIconCurrent->ExtractEditableBitmap(
                              hBmpCopy,
                              clrTransparent
                              ) )
                  ||    (! ::OpenClipboard( m_hWndCustomizeForm ) )
                  )
            {
                  ASSERT( FALSE );
                  if( hBmpCopy != NULL )
                        ::DeleteObject( hBmpCopy );
                  return true;
            }
            ASSERT( hBmpCopy != NULL );
            if( ::EmptyClipboard() )
            {
                  HGLOBAL     hGlobal =
                        CExtBitmap::stat_HBITMAPtoHGLOBAL(
                              hBmpCopy
                              );
                  if( hGlobal != NULL )
                  {
                        if( ::SetClipboardData( CF_DIB, hGlobal ) == NULL )
                        {
                              ASSERT( FALSE );
                        }
                  } // if( hGlobal != NULL )
#ifdef _DEBUG
                  else
                  {
                        ASSERT( FALSE );
                  } // else from if( hGlobal != NULL )
#endif // _DEBUG
            } // if( ::EmptyClipboard() )
#ifdef _DEBUG
            else
            {
                  ASSERT( FALSE );
            } // else from if( ::EmptyClipboard() )
#endif // _DEBUG
            ::DeleteObject( hBmpCopy );
            ::CloseClipboard();
            return true;
      }
      case ID_EXT_BTN_IMAGE_PASTE:
            ASSERT( bCanChangeDisplayStyle );
            ASSERT( !_iconPasteFromClipBoard.IsEmpty() );
            ASSERT( pIconCurrent != NULL );
            ASSERT(
                        pIconCurrent->IsEmpty()
                  ||    pIconCurrent->GetSize() == _iconPasteFromClipBoard.GetSize()
                  );
            pIconCurrent->AssignFromOther( _iconPasteFromClipBoard );
            ASSERT( !pIconCurrent->IsEmpty() );
            RedrawCommandItems( pNodeC->GetCmdID( false ) );
            return true;
      case ID_EXT_BTN_IMAGE_RESET:
            ASSERT( bCanChangeDisplayStyle );
            pNodeC->ResetIcon( pCmdItem );
            RedrawCommandItems( pNodeC->GetCmdID( false ) );
            return true;
#if (!defined __EXT_MFC_NO_ICONEDITDLG)
      case ID_EXT_BTN_IMAGE_EDIT:
      {
            ASSERT( bCanChangeDisplayStyle );
            ASSERT( pIconCurrent != NULL );
            ASSERT( pNodeC->GetIconPtrInToolbar( pCmdItem, true ) != NULL );
            ASSERT( !pNodeC->GetIconPtrInToolbar( pCmdItem, true )->IsEmpty() );
            
            BOOL bMenu = 
                  pObjEventSrc->IsKindOf(RUNTIME_CLASS(CExtPopupMenuWnd));

            CExtIconEditDlg dlg(
                  bMenu
                        ? ((CWnd*)pObjEventSrc)
                        : CWnd::FromHandle(m_hWndCustomizeForm)
                  );
            
            if( bMenu )
            {
                  ASSERT_VALID( m_pPopupDropTargetTop );
                  ASSERT( m_pPopupDropTargetTop->GetSafeHwnd() != NULL );
                  m_pPopupDropTargetTop->_DoShowChain( SW_HIDE );
            }

            dlg.m_icon.AssignFromOther(
                  pIconCurrent->IsEmpty()
                        ? (* pNodeC->GetIconPtrInToolbar( pCmdItem, true ) )
                        : (* pIconCurrent )
                  );
            ASSERT( ! dlg.m_icon.IsEmpty() );
            
            { // BLOCK: load alternate caption string

#if (!defined __EXT_PROFUIS_STATIC_LINK || defined __EXT_PROFUIS_STATIC_LINK_WITH_RESOURCES)
      CExtLocalResourceHelper _LRH;
#endif
                  CExtSafeString strAlternateCaption;
                  if( ! g_ResourceManager->LoadString( strAlternateCaption, IDS_EXT_BUTTON_EDITOR_CAPTION ) )
                        strAlternateCaption = _T("Button Editor");

                  dlg.m_strAlternateCaption = strAlternateCaption;

            } // BLOCK: load alternate caption string
            
            dlg.m_dwIconViewerStyles |= __EIEDWS_BUTTON_FRAME|__EIEDWS_OUTER_AREA|__EIEDWS_OUTER_TOOLS;
            dlg.m_dwIconEditorStyles &= ~(__EIEDWS_OUTER_TOOLS);
            
            bool bModalOK = ( dlg.DoModal() == IDOK ) ? true : false;

            if( bMenu && m_pPopupDropTargetTop->GetSafeHwnd() != NULL )
                  m_pPopupDropTargetTop->_DoShowChain( SW_SHOWNA );

            if( !bModalOK )
                  return bTextChanged;
            ASSERT( ! dlg.m_icon.IsEmpty() );
            pIconCurrent->AssignFromOther( dlg.m_icon );
            ASSERT( ! pIconCurrent->IsEmpty() );

            RedrawCommandItems( pNodeC->GetCmdID( false ) );
            return true;
      }
      case ID_EXT_BTN_IMAGE_CHANGE:
      {
            RedrawCommandItems( pNodeC->GetCmdID( false ) );
            return true;
      }
#endif // (!defined __EXT_MFC_NO_ICONEDITDLG)
      case ID_EXT_BTN_STYLE_DEFAULT:
            ASSERT( bCanChangeDisplayStyle );
            if( (pNodeC->GetFlags() & __ECTN_DISPLAY_MASK)
                        == __ECTN_DISPLAY_DEFAULT_STYLE
                  )
                  return bTextChanged;
            pNodeC->ModifyFlags( 0, __ECTN_DISPLAY_MASK );
            pNodeC->ModifyFlags( __ECTN_DISPLAY_DEFAULT_STYLE );
            if(         pObjEventSrc != NULL
                  &&    pObjEventSrc->IsKindOf(RUNTIME_CLASS(CExtToolControlBar))
                  )
            {
                  ASSERT_VALID( pObjEventSrc );
                  CExtToolControlBar * pToolBar =
                        STATIC_DOWNCAST( CExtToolControlBar, pObjEventSrc );
                  if(         pToolBar->GetSafeHwnd() != NULL
                        &&    pToolBar->m_pDockSite != NULL
                        )
                  {
                        CFrameWnd * pFrame = pToolBar->GetParentFrame();
                        pFrame->RecalcLayout();
                        pToolBar->RedrawWindow(
                              NULL,
                              NULL,
                              RDW_INVALIDATE|RDW_UPDATENOW|RDW_ERASE|RDW_ERASENOW
                                    |RDW_ALLCHILDREN|RDW_FRAME
                              );
                  }
            }
            return true;
      case ID_EXT_BTN_STYLE_TEXT_ONLY_ALWAYS:
            ASSERT( bCanChangeDisplayStyle );
            if( (pNodeC->GetFlags() & __ECTN_DISPLAY_MASK)
                        == __ECTN_DISPLAY_TEXTONLY_ALWAYS
                  )
                  return bTextChanged;
            pNodeC->ModifyFlags( 0, __ECTN_DISPLAY_MASK );
            pNodeC->ModifyFlags( __ECTN_DISPLAY_TEXTONLY_ALWAYS );
            if(         pObjEventSrc != NULL
                  &&    pObjEventSrc->IsKindOf(RUNTIME_CLASS(CExtToolControlBar))
                  )
            {
                  ASSERT_VALID( pObjEventSrc );
                  CExtToolControlBar * pToolBar =
                        STATIC_DOWNCAST( CExtToolControlBar, pObjEventSrc );
                  if(         pToolBar->GetSafeHwnd() != NULL
                        &&    pToolBar->m_pDockSite != NULL
                        )
                  {
                        CFrameWnd * pFrame = pToolBar->GetParentFrame();
                        pFrame->RecalcLayout();
                        pToolBar->RedrawWindow(
                              NULL,
                              NULL,
                              RDW_INVALIDATE|RDW_UPDATENOW|RDW_ERASE|RDW_ERASENOW
                                    |RDW_ALLCHILDREN|RDW_FRAME
                              );
                  }
            }
            return true;
      case ID_EXT_BTN_STYLE_TEXT_ONLY_IN_MENUS:
            ASSERT( bCanChangeDisplayStyle );
            if( (pNodeC->GetFlags() & __ECTN_DISPLAY_MASK)
                        == __ECTN_DISPLAY_TEXTONLY_IN_MENU
                  )
                  return bTextChanged;
            pNodeC->ModifyFlags( 0, __ECTN_DISPLAY_MASK );
            pNodeC->ModifyFlags( __ECTN_DISPLAY_TEXTONLY_IN_MENU );
            if(         pObjEventSrc != NULL
                  &&    pObjEventSrc->IsKindOf(RUNTIME_CLASS(CExtToolControlBar))
                  )
            {
                  ASSERT_VALID( pObjEventSrc );
                  CExtToolControlBar * pToolBar =
                        STATIC_DOWNCAST( CExtToolControlBar, pObjEventSrc );
                  if(         pToolBar->GetSafeHwnd() != NULL
                        &&    pToolBar->m_pDockSite != NULL
                        )
                  {
                        CFrameWnd * pFrame = pToolBar->GetParentFrame();
                        pFrame->RecalcLayout();
                        pToolBar->RedrawWindow(
                              NULL,
                              NULL,
                              RDW_INVALIDATE|RDW_UPDATENOW|RDW_ERASE|RDW_ERASENOW
                                    |RDW_ALLCHILDREN|RDW_FRAME
                              );
                  }
            }
            return true;
      case ID_EXT_BTN_STYLE_IMAGE_AND_TEXT:
            ASSERT( bCanChangeDisplayStyle );
            if( (pNodeC->GetFlags() & __ECTN_DISPLAY_MASK)
                        == __ECTN_DISPLAY_TEXT_AND_IMAGE
                  )
                  return bTextChanged;
            pNodeC->ModifyFlags( 0, __ECTN_DISPLAY_MASK );
            pNodeC->ModifyFlags( __ECTN_DISPLAY_TEXT_AND_IMAGE );
            if(         pObjEventSrc != NULL
                  &&    pObjEventSrc->IsKindOf(RUNTIME_CLASS(CExtToolControlBar))
                  )
            {
                  ASSERT_VALID( pObjEventSrc );
                  CExtToolControlBar * pToolBar =
                        STATIC_DOWNCAST( CExtToolControlBar, pObjEventSrc );
                  if(         pToolBar->GetSafeHwnd() != NULL
                        &&    pToolBar->m_pDockSite != NULL
                        )
                  {
                        CFrameWnd * pFrame = pToolBar->GetParentFrame();
                        pFrame->RecalcLayout();
                        pToolBar->RedrawWindow(
                              NULL,
                              NULL,
                              RDW_INVALIDATE|RDW_UPDATENOW|RDW_ERASE|RDW_ERASENOW
                                    |RDW_ALLCHILDREN|RDW_FRAME
                              );
                  }
            }
            return true;
      case ID_EXT_BTN_BEGIN_A_GROUP:
            ASSERT( bCanAddRemoveSeparator );
            if( pNodeC->GetFlags() & __ECTN_GROUP_START )
                  pNodeC->ModifyFlags( 0, __ECTN_GROUP_START );
            else
                  pNodeC->ModifyFlags( __ECTN_GROUP_START );
            if(         pObjEventSrc != NULL
                  &&    pObjEventSrc->IsKindOf(RUNTIME_CLASS(CExtToolControlBar))
                  )
            {
                  ASSERT_VALID( pObjEventSrc );
                  CExtToolControlBar * pToolBar =
                        STATIC_DOWNCAST( CExtToolControlBar, pObjEventSrc );
                  if(         pToolBar->GetSafeHwnd() != NULL
                        &&    pToolBar->m_pDockSite != NULL
                        )
                  {
                        CFrameWnd * pFrame = pToolBar->GetParentFrame();
                        pFrame->RecalcLayout();
                        pToolBar->RedrawWindow(
                              NULL,
                              NULL,
                              RDW_INVALIDATE|RDW_UPDATENOW|RDW_ERASE|RDW_ERASENOW
                                    |RDW_ALLCHILDREN|RDW_FRAME
                              );
                  }
            }
            return true;
#ifdef _DEBUG
      case ID_EXT_BTN_NAME:
            ASSERT( FALSE );
            return bTextChanged;
#endif // _DEBUG
      default:
            if(         nIdIconPaletteFirst <= nCmdRetVal
                  &&    nCmdRetVal < ( nIdIconPaletteFirst + UINT(sizePaletteDimension.cx*sizePaletteDimension.cy) )
                  )
            { // if change icon from palette
                  ASSERT( bCanChangeDisplayStyle );
                  ASSERT( pIconCurrent != NULL );
                  CPoint ptBitmapOffset(
                        (nCmdRetVal-nIdIconPaletteFirst)*sizeBitmapPart.cx,
                        0
                        );
                  CRect rcBitmapPart(
                        ptBitmapOffset,
                        sizeBitmapPart
                        );
                  CExtCmdIcon _icon;
                  _icon.m_bmpNormal.FromBitmap(
                        _bmpPalette,
                        &rcBitmapPart
                        );
                  ASSERT( !_icon.IsEmpty() );
                  if( clrTransparent != COLORREF(-1L) )
                        _icon.m_bmpNormal.AlphaColor( clrTransparent, RGB(0,0,0), 0 );
                  ASSERT( ! _icon.IsEmpty() );
                  pIconCurrent->AssignFromOther( _icon );
                  ASSERT( ! pIconCurrent->IsEmpty() );
                  RedrawCommandItems( pNodeC->GetCmdID( false ) );
                  return true;
            } // if change icon from palette
#ifdef _DEBUG
            ASSERT( FALSE );
            //return bTextChanged;
#endif // _DEBUG
      break;
      } // switch( nCmdRetVal )
      return bTextChanged;
}