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..

srikadiAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ZoppoCommented:
Hi srikadi,

IMO the problem is the loop:
> while ( !(m_mainToolBar.GetButtonStyle(i) & TBBS_SEPARATOR) )

This will run until the first seperator-button is found, then it stops. I guess it should be something like this:

> for (i=0;i<m_mainToolBar.GetCount();i++)
> {
>   if( 0 != (m_mainToolBar.GetButtonStyle(i) & TBBS_SEPARATOR) )
>   {
>     // don't add text for seperator
>     continue;
>   }
>
>   m_mainToolBar.SetButtonStyle(i,TBBS_CHECKGROUP);
>
>   buttonText.LoadString(toolbarTextIds[index]);
>
>   m_mainToolBar.SetButtonText(i,buttonText);
>
>   index++;
> }


Hope that helps,

ZOPPO

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
srikadiAuthor Commented:
wow..its worked perfectly..
thanx..
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.