Link to home
Start Free TrialLog in
Avatar of srikadi
srikadi

asked on

How to add separator to CToolBar?

Hi,
i added some button in CtoolBar after separator.but it s not showing names for the buttons.
now i have separator before IDS_ENABLESCAN id which isTBBS_CHECKGROUP.but i was adding simple buttons after sepearator.with out separator its working fine..
      CDC* dc = m_mainToolBar.GetDC();
      CSize size;
      size = dc->GetTextExtent("Test");
      button.cy += size.cy;
      
      m_mainToolBar.SetSizes(button,bitmap);

      //setting the buttons to be radio style
      int i =0;

      while ( !(m_mainToolBar.GetButtonStyle(i) & TBBS_SEPARATOR) )
      {
            m_mainToolBar.SetButtonStyle(i,TBBS_CHECKGROUP);

            buttonText.LoadString(toolbarTextIds[index]);

            m_mainToolBar.SetButtonText(i,buttonText);

            index++;
            i++;
      }

      //the following buttons is used to start/pause the network scanning

//Ramesh - TL_C1_4_FEA_09 - XC Support of IP DCN Mgmt - Start
      m_mainToolBar.SetButtonStyle(7,TBBS_CHECKBOX);
      buttonText.LoadString(IDS_ENABLESCAN);
      m_mainToolBar.SetButtonText(7,buttonText);
//Ramesh - TL_C1_4_FEA_09 - XC Support of IP DCN Mgmt - End

      CSize tbSize;
      tbSize.cy = button.cy;
      tbSize.cx = 0;

      CRect butRect;
      for (i=0;i<m_mainToolBar.GetCount();i++)
      {
            m_mainToolBar.GetItemRect(i, butRect);
            tbSize.cx += butRect.Width();
      }

      return tbSize;
static UINT toolbarTextIds[] =
{
//Ramesh - TL_C1_4_FEA_012 - Usability Enhancements - Start
    IDS_TOOLBAR_NW,          
    IDS_TOOLBAR_SWPL,
      IDS_TOOLBAR_TSK,
    IDS_TOOLBAR_ERR ,        
    IDS_TOOLBAR_LOGS,
      IDS_NODE_SOFTVIEW,
      IDS_ENABLESCAN
};
so please to add sepatrator between buttons..

ASKER CERTIFIED SOLUTION
Avatar of Zoppo
Zoppo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of srikadi
srikadi

ASKER

wow..its worked perfectly..
thanx..