No announcement yet.

Vertical toolbar w/buttons: how to?

  • Filter
  • Time
  • Show
Clear All
new posts

    Vertical toolbar w/buttons: how to?

    <font face="courier new, courier" size="3"><pre>i'm giving up on this one. i cannot work out the correct
    method for creating a vertical toolbar w/buttons successfully. you
    can take lance's simple toolbar example as the point of reference:

    all information i've checked says that the following modification of
    lance's original code should create the vertical toolbar correctly:

    control add "toolbarwindow32", hdlg, %id_toolbar, ", 0, 0, 1, 32, _
    %ws_child or %ws_border or %ws_visible or _
    %ccs_left or %tbstyle_tooltips or %tb_autosize

    (lance's original code uses %ccs_top instead of %ccs_left.)

    the toolbar which is created does appear vertically on the left. the
    problem centers on the fact that no buttons appear on the toolbar.

    i've experimented with the style constants but now suspect that
    additional steps are necessary. any info would be appreciated.

    -- greg
    [email protected]


    The solution is very "easy".

    The key to remember is that when a Toolbar will "wrap" itself to the Dialog when you autosize it.

    Simply create a Child Dialog (%WS_CHILD) within your Main Dialog and put the Toolbar in the Child

    Size the Child Dialog to the width and height you want your toolbar and then the Toolbar will autowrap within the Child dialog.

    |              Main Dialog              |
    |  ********                             |
    |  |Child |                             |
    |  |Dialog|                             |
    |  |      |                             |
    |  |w/    |                             |
    |  |Toolbar                             |
    |  ********                             |
    |                                       |

    Chris Boss
    Computer Workshop
    Developer of "EZGUI"


      Your suggestion has more than one virtue because it certainly 
      enhances control over the toolbar.  It does add another level of 
      complexity to an interface, but I'll certainly think over this 
      However, I remain curious about %CCS_LEFT.  The style exists.  What's 
      required to create a vertical toolbar--and its buttons--using this 
      -- Greg
      [email protected]


        Greg --
        There is a lot of CCS-styles, including CCS_VERT.
        But not all works with toolbars.

        From MSDN(with VB6)

        Toolbar Size and Position
        The window procedure for a toolbar automatically sets the size and position of the toolbar window. The height is based on the height of the buttons in the toolbar. The width is the same as the width of the parent window's client area. The CCS_TOP and CCS_BOTTOM common control styles determine whether the toolbar is positioned along the top or bottom of the client area. By default, a toolbar has the CCS_TOP style.

        I tested CCS_NOPARENTALIGN - under Win2000, at least, works.
        But such as CCS_VERT/LEFT ... - I can see a border only.




          I use %CCS_NORESIZE & %CCS_NODIVIDER in ex_style in the create window, then I send a
          %TB_SETROWS message to the toolbar. After that I set my position and display it. I have a vertical
          toolbar with 2 buttons per row. That should help, if not I'll have to decipher my code to figure out
          why I have some stuff hard-coded so I can post a working example, but I'm kinda busy right now.


          Some info on TB_SETROWS:


          Sets the number of rows of buttons in a toolbar.

          wParam = (WPARAM) MAKEWPARAM(cRows, fLarger);
          lParam = (LPARAM) (LPRECT) lprc;

          Number of rows requested. The minimum number of rows is one, and the maximum number of rows is equal to the number of buttons in the toolbar.
          Flag that indicates whether to create more rows than requested when the system cannot create the number of rows specified by cRows. If this parameter is TRUE, the system creates more rows. If it is FALSE, the system creates fewer rows.
          Address of a RECT structure that receives the bounding rectangle of the toolbar after the rows are set.
          Return Values
          No return value.

          Because the system does not break up button groups when setting the number of rows, the resulting number of rows might differ from the number requested.

          Windows NT/2000: Requires Windows NT 3.51 or later
          Windows 95/98: Requires Windows 95 or later
          Windows CE: Requires version 1.0 or later.
          Header: Declared in commctrl.h.



            According to Microsoft, %CCS_LEFT is supposed to work with toolbars.  
            All that's required is COMCTL32.DLL ver. 4.71 (distributed first with 
            IE4) or later. 
             [quote]I tested CCS_NOPARENTALIGN - under Win2000, at least, works.
            But such as CCS_VERT/LEFT ... - I can see a border only.[/quote]
            This is what I've found as well.  I'm now more certain than ever 
            that additional steps are required to use some of more recent toolbar 
            styles.  I've started searching newgroup postings and plan to dig 
            elsewhere too.
            If I do determine the correct magic, I'll be sure to reveal it here. 
            Thanks for the description of your approach.  I'll experiment with it.  
            I read the Microsoft info on %TB_SETROWS at some point but never paid 
            enough attention (especially to the implications of all of the 
            parameters).  It's working for you, and that's certainly a valuable 

            -- Greg
            [email protected]


              Originally posted by Greg Turgeon:
              According to Microsoft, %CCS_LEFT is supposed to work with toolbars.
              All that's required is COMCTL32.DLL ver. 4.71 (distributed first with
              IE4) or later.

              Prepared Jan, 5, 2000