Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

multi row CToolBarCtrl

Posted on 2001-09-06
2
Medium Priority
?
1,149 Views
Last Modified: 2013-11-20
I wanted to create a square block of buttons and thought
that CToolBarCtrl would be a good start, but I could not get SetRows to work. Eventually I found that creating the control with the CCS_NORESIZE is necessary, and that contary to the documentation TBSTYLE_WRAPABLE has no effect.

BOOL CDlg::OnInitDialog()
{
  TBBUTTON  v[] = {
    {0, 1000, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, NULL},  
    {0, 1001, TBSTATE_ENABLED, TBSTYLE_BUTTON,  0, NULL},
    {0, 1002, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, NULL},  
    {0, 1003, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, NULL}
    };

  CDialog::OnInitDialog();

  CToolBarCtrl* pctrl = new CToolBarCtrl;
  CRect rect(20,30,60,70);
  //This works
  //pctrl->Create(WS_CHILD|WS_VISIBLE|CCS_NOPARENTALIGN|CCS_NODIVIDER|CCS_NORESIZE, rect, this, 100);
  //This doesn't
  pctrl->Create(WS_CHILD|WS_VISIBLE|CCS_NOPARENTALIGN|CCS_NODIVIDER|TBSTYLE_WRAPABLE, rect, this, 100);
  pctrl->AddButtons(4, v);
  pctrl->SetRows(2, true, &rect);

     return TRUE;
  }

Can someone explain what is going on, or point me at documentation which would have saved me hours of grief?
Cheers Greg
0
Comment
Question by:GGRUNDY
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 2

Accepted Solution

by:
BogdyPtr earned 300 total points
ID: 6460786
    CToolBarCtrl* pctrl = new CToolBarCtrl;
     CRect rect(20,30,70,80);
     //This works
     //     pctrl->Create(WS_CHILD|WS_VISIBLE|CCS_NOPARENTALIGN|CCS_NODIVIDER|CCS_NORESIZE, rect, this, 100);
     //This too, toolbar style TBSTYLE_WRAPABLE works only with CCS_NORESIZE else the toolbar is autoresized to so buttons can fit
     pctrl->Create(WS_CHILD|WS_VISIBLE|CCS_NOPARENTALIGN|CCS_NODIVIDER|CCS_NORESIZE|TBSTYLE_WRAPABLE, rect, this, 100);
     pctrl->AddButtons(5,v);
     //you don't need to set rows anymore    
0
 
LVL 3

Author Comment

by:GGRUNDY
ID: 6460885
Thanks,

>TBSTYLE_WRAPABLE works only with CCS_NORESIZE
Have you found this documented anywhere?
0

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question