?
Solved

multi row CToolBarCtrl

Posted on 2001-09-06
2
Medium Priority
?
1,125 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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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…
Suggested Courses

762 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