Newbie api question: I want to make a toolbar using CreateToolbarEx with its array of tbbutton structures. What values in a tbbutton will give rise to a separator, or do I have to use the TB_INSERTBUTTON or TB_ADDBUTTONS message?
Posted on 2001-06-01 02:08:00 by Larry Hammick
in your tbbutton struct you need to have your fsStyle set to TBSTYLE_SEP. the rest of the struct can be null. smurf
Posted on 2001-06-01 02:34:00 by smurf
Thx Smurf but I tried that. Instead of a separator I get a greyed "cut" button (in accordance with STD_CUT equ 0).
Posted on 2001-06-01 04:39:00 by Larry Hammick
hi yes you have to send the TB_ADDBUTTONS message to your toolbar and in the TBBUTTON struct try use fsState = TBSTATE_ENABLED (4h) fsStyle = TBSTYLE_SEP (1h) the rest of the struct fill with zeros.. also.. try not to use zero in one of your buttons ID er.. don't know if this will work.. there's at least one example in the MASM32 package and Test Department has some too ensein
Posted on 2001-06-01 06:06:00 by ensein
you shouldnt need to use tb_addbuttons. your probably doing something very minor you may have overlooked. let see your tbbutton struct and your createwindowex. smurf
Posted on 2001-06-01 12:40:00 by smurf

.data
tbButtons   dd STD_FILENEW,ResID_New
            dw TBSTATE_ENABLED,TBSTYLE_BUTTON
            dd 0,0

            dd STD_FILEOPEN,ResID_Open
            dw TBSTATE_ENABLED,TBSTYLE_BUTTON
            dd 0,0

            dd 0,0
            dw 0,TBSTYLE_SEP
            dd 0,0

            dd STD_FILESAVE,ResID_Save
            dw TBSTATE_ENABLED,TBSTYLE_BUTTON
            dd 0,0

.code
invoke CreateToolbarEx,hWin,WS_CHILD+WS_BORDER+WS_VISIBLE+TBSTYLE_TOOLTIPS, \
    ID_Toolbar,0Bh,HINST_COMMCTRL,IDB_STD_SMALL_COLOR,  \
    ADDR tbButtons,4,10h,10h,10h,10h,SIZEOF(TBBUTTON)
;hWin is from the stack, not a global.
end start
I tried this too for the separator: dd 0,0 dw TBSTATE_ENABLED,TBSTYLE_SEP dd 0,0 and I got a "cut" button. The buttons show up and work, with or without the TBSTYLE_TOOLTIPS bit. Putting all the buttons at once with the addbuttons message produces the same result as the above. Thanks for your time. I suspect I'm just overlooking something trivial.
Posted on 2001-06-01 19:33:00 by Larry Hammick
if i understand you correctly when you say cut you mean the button portion of your button are cut off. to prevent this you need to send this message:
invoke  SendMessage, hToolBar, TB_AUTOSIZE, NULL, NULL
as for showing your separtors place this into your createwindowex:
invoke CreateToolbarEx,hWin,WS_CHILD+WS_VISIBLE+TBSTYLE_TOOLTIPS+TBSTYLE_FLAT, \
    ID_Toolbar,0Bh,HINST_COMMCTRL,IDB_STD_SMALL_COLOR,  \
    ADDR tbButtons,4,10h,10h,10h,10h,SIZEOF(TBBUTTON
i only had a few minutes to come up with this i have to goto work. smurf
Posted on 2001-06-01 19:49:00 by smurf
No, sorry, I mean that instead of separator I get a button with a pair of scissors on it, a default graphic for cut-to-clipboard operations. PS (edit): Problem solved. Trivial, as we thought. Win32.hlp defines tbbutton dd ?,? db state db style dd ?,? but this gives rise to the wrong value for sizeof tbbutton. So I thought it should be dd ?,? dw state dw style dd ?,? Not so. As Test Department shows, it should be: dd ?,? db state db style dw ? dd ?,? Thanks again. This message was edited by Larry Hammick, on 6/2/2001 1:33:19 AM
Posted on 2001-06-02 01:07:00 by Larry Hammick