Print Page | Close Window

I hope to chage icon on commandbar

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=13571
Printed Date: 28 February 2025 at 7:36am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: I hope to chage icon on commandbar
Posted By: copycdx2
Subject: I hope to chage icon on commandbar
Date Posted: 04 March 2009 at 3:03am
first, load prestate.
 
LoadCommandBars(XTP_REG_TOOLBAR);
 
I use commandbars with icon.
below code.
 
  pCommandBars->GetImageManager()->SetIcon( IDI_NC_LOGIN, IDI_NC_LOGIN );
  pCommandBars->GetImageManager()->SetIcon( IDI_NC_LOGOUT, IDI_NC_LOGOUT );
 
 
I hope to change icon in order to display toggle-state.
but, iconimage is not change.
 
 
 CXTPCommandBars* pCommandBars = GetCommandBars();
 if(pCommandBars == NULL)
 {
  TRACE0("Failed to create command bars object.\n");
  return;      // fail to create
 }

 CXTPToolBar* pToolBar = (CXTPToolBar*)pCommandBars->GetToolBar(IDR_TOOLBAR_NC02);
 if( pToolBar )
 {
  CXTPControls* pControls = pToolBar->GetControls();
  if( pControls )
  {
   CXTPControl* pCtrl = pControls->FindControl( ID_NCLOGIN );
   if( pCtrl )
   {
    if( bLoged )
     pCtrl->SetIconId(IDI_NC_LOGIN);
    else
     pCtrl->SetIconId(IDI_NC_LOGOUT);

    RecalcLayout(FALSE);
    pCommandBars->RedrawCommandBars();
    RedrawWindow();
   }
  }
 }




Replies:
Posted By: Oleg
Date Posted: 04 March 2009 at 3:37am
Hi,
 
Code looks right. Are you sure you call it after LoadCommandBars ? pCtrl  not NULL ?


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net