Announcement

Collapse
No announcement yet.

TB_SETBUTTONSIZE

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • TB_SETBUTTONSIZE

    Guys --
    Somebody have successful sample ?
    TB_SETBUTTONWIDTH works; TB_SETBUTTONSIZE returns 1, but changes nothing


    ------------------
    E-MAIL: [email protected]

  • #2
    This is what I do in own MDI editor with three toolbars, one parent and
    two smaller ones above each other on that one. Enables me to position
    them where I want. To make parent height big enough for the two childs,
    I set big button size on that one. hToolBar is parent and actually has
    no buttons on it, but works same anyway.
    Code:
      hToolbar = CreateToolbarEx(hWnd, %WS_CHILD OR %WS_VISIBLE OR %TBSTYLE_TOOLTIPS, _
                    %ID_TOOLBAR, 0, hInst, 0, tbb(0), 0, 0, 0, 21, 20, LEN(TBBUTTON))
      SendMessage hToolbar, %TB_SETBUTTONSIZE, 0, MAKLNG(60, 50)
    ------------------
    Should add: if toolbar has buttons, %TB_SETBUTTONSIZE must be set before adding them..


    [This message has been edited by Borje Hagsten (edited October 13, 2001).]

    Comment


    • #3
      I played with it once a year or two back and gave up (too busy to spend too much time with it).

      Button size always seems to depend on image size and widest string label size.

      Might be worth doing an http://groups.google.com search, see if anyone cracked the mystery.

      ------------------
      Lance
      PowerBASIC Support
      mailto:[email protected][email protected]</A>
      Lance
      mailto:[email protected]

      Comment


      • #4
        Borje --
        Thanx. This works, but I use CreateWindowEx.
        Code:
           hwndTB = CreateWindowEx(%WS_EX_WINDOWEDGE, "ToolBarWindow32", ByVal 0, _
                  %WS_CHILD Or %CCS_ADJUSTABLE Or %CCS_TOP Or %TBSTYLE_TOOLTIPS, _
                  0, 0, 0, 0, hwndParent, %ID_TOOLBAR, GetModuleHandle(""), ByVal 0)
        Then I correct some styles.

        Reading MSDN, I understood that I need exactly CreateWindowEx (image lists, customdraw ?)
        Maybe I will be able to bypass restrictions, but it will be nice to set button size for CreateWindowEx also.



        ------------------
        E-MAIL: [email protected]

        Comment


        • #5
          What is difference? I get exact same result by using CreateWindowEx, like this:
          Code:
            hToolbar = CreateWindowEx(%WS_EX_WINDOWEDGE, "ToolBarWindow32", ByVal 0, _
                         %WS_CHILD Or %CCS_ADJUSTABLE Or %CCS_TOP Or %TBSTYLE_TOOLTIPS, _
                         0, 0, 0, 0, hWnd, %ID_TOOLBAR, hInst, ByVal 0)   
            SendMessage hToolbar, %TB_BUTTONSTRUCTSIZE, LEN(TBBUTTON), 0
            SendMessage hToolbar, %TB_SETBUTTONSIZE, 0, MAKLNG(60, 50)
          Seems CreateToolbarEx is macro for the above (except TB_SETBUTTONSIZE of course).
          Lance, the trick is to send %TB_SETBUTTONSIZE after %TB_ADDSTRING. Works fine
          for me here.


          ------------------




          [This message has been edited by Borje Hagsten (edited October 13, 2001).]

          Comment


          • #6
            Borje --
            thanx. Because it should work, I decided to analyze different sequences of messages.
            "Enemy" was TB_ADDBITMAP. TB_SETBUTTONSIZE after it works fine.

            ------------------
            E-MAIL: [email protected]

            Comment

            Working...
            X