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?
in your tbbutton struct you need to have your fsStyle set to TBSTYLE_SEP. the rest of the struct can be null. smurf
Thx Smurf but I tried that. Instead of a separator I get a greyed "cut" button (in accordance with STD_CUT equ 0).
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
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
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.
.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
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:
as for showing your separtors place this into your createwindowex:
invoke SendMessage, hToolBar, TB_AUTOSIZE, NULL, NULL
i only had a few minutes to come up with this i have to goto work. smurf
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
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