几何尺寸与公差论坛

 找回密码
 注册
查看: 883|回复: 0

【转帖】how do i add a separator on a custom addin toolbar

[复制链接]
发表于 2009-4-12 21:09:50 | 显示全部楼层 |阅读模式
how do i add a separator on a custom addin toolbar?
i would like to seperate some buttons on my custom addin toolbar. anyone know a command for this?
cswp
solidworks office professional 2008, sp 3.1
pc #1:
dell precision t3400, core2duo 2.33ghz, 4gb ram,
nvidia quadro fx 1700
pc #2:
dell precision 380, p4 3.80ghz, 2gb ram,
nvidia quadro fx 1400
the only way i know of to add separators to menus etc.. is to add command tab boxes, get the command tab for your command group using:
cmdtab = icmdmgr.getcommandtab(doctype, title)
dim cmdbox as commandtabbox = cmdtab.addcommandtabbox
and then you can call:
cmdtab.addseparator(cmdbox1, cmdgroup.toolbarid)
answer actually i ended up using this command
cmdgroup.addspacer2(-1, x)
x=
1 is for the toolbar
2 is for the command menu
3 add them to use a seperator at both places.
cswp
solidworks office professional 2008, sp 3.1
pc #1:
dell precision t3400, core2duo 2.33ghz, 4gb ram,
nvidia quadro fx 1700
pc #2:
dell precision 380, p4 3.80ghz, 2gb ram,
nvidia quadro fx 1400
chris & luke, i'm trying to do the same thing. i can add a single separator into my commandtab, but i can't put multiple separators in. how would you do that with addspacer2/addseparator? here is the code i have, elaborated on from the api example:
cmdtab = icmdmgr.addcommandtab(doctype, title)
dim cmdbox as commandtabbox = cmdtab.addcommandtabbox
dim cmdids(5) as integer
dim texttype(5) as integer
cmdids(0) = cmdgroup.commandid(cmdindex0)
texttype(0) = swcommandtabbuttontextdisplay_e.swcommandtabbutton_texthorizontal
cmdids(1) = cmdgroup.commandid(cmdindex1)
texttype(1) = swcommandtabbuttontextdisplay_e.swcommandtabbutton_texthorizontal
cmdids(2) = cmdgroup.commandid(cmdindex2)
texttype(2) = swcommandtabbuttontextdisplay_e.swcommandtabbutton_texthorizontal
cmdids(3) = cmdgroup.commandid(cmdindex3)
texttype(3) = swcommandtabbuttontextdisplay_e.swcommandtabbutton_texthorizontal
cmdids(4) = cmdgroup.commandid(cmdindex4)
texttype(4) = swcommandtabbuttontextdisplay_e.swcommandtabbutton_texthorizontal
bresult = cmdbox.addcommands(cmdids, texttype)
dim cmdbox1 as commandtabbox = cmdtab.addcommandtabbox
dim cmdids1(6) as integer
dim texttype1(6) as integer
cmdids1(0) = cmdgroup.commandid(cmdindex5)
texttype1(0) = swcommandtabbuttontextdisplay_e.swcommandtabbutton_texthorizontal
cmdids1(1) = cmdgroup.commandid(cmdindex6)
texttype1(1) = swcommandtabbuttontextdisplay_e.swcommandtabbutton_texthorizontal
cmdids1(2) = cmdgroup.commandid(cmdindex7)
texttype1(2) = swcommandtabbuttontextdisplay_e.swcommandtabbutton_texthorizontal
cmdids1(3) = cmdgroup.commandid(cmdindex8)
texttype1(3) = swcommandtabbuttontextdisplay_e.swcommandtabbutton_texthorizontal
cmdids1(4) = cmdgroup.commandid(cmdindex9)
texttype1(4) = swcommandtabbuttontextdisplay_e.swcommandtabbutton_texthorizontal
cmdids1(5) = cmdgroup.commandid(cmdindex10)
texttype1(5) = swcommandtabbuttontextdisplay_e.swcommandtabbutton_texthorizontal
bresult = cmdbox1.addcommands(cmdids1, texttype1)
cmdtab.addseparator(cmdbox1, cmdgroup.toolbarid)
dim cmdbox2 as commandtabbox = cmdtab.addcommandtabbox
dim cmdids2(3) as integer
dim texttype2(3) as integer
cmdids2(0) = cmdgroup.commandid(cmdindex11)
texttype2(0) = swcommandtabbuttontextdisplay_e.swcommandtabbutton_texthorizontal
cmdids2(1) = cmdgroup.commandid(cmdindex12)
texttype2(1) = swcommandtabbuttontextdisplay_e.swcommandtabbutton_texthorizontal
cmdids2(2) = cmdgroup.commandid(cmdindex13)
texttype2(2) = swcommandtabbuttontextdisplay_e.swcommandtabbutton_texthorizontal
bresult = cmdbox2.addcommands(cmdids2, texttype2)
cmdtab.addseparator(cmdbox2, cmdgroup.toolbarid)
essentially, i want to have two separators after the 5th & 11th buttons in my 14-button toolbar (5 | 6 | 3 button display). every time i edit this in vb express 2008, it goes smoothly, but the separators don't show up in solidworks. any ideas?
to defeat the wheat, go against the grain.
edited: 02/20/2009 at 05:01 pm by tom fosler
gentlemen, i believe i discovered the solution myself:
cmdtab = icmdmgr.addcommandtab(doctype, title)
dim cmdbox as commandtabbox = cmdtab.addcommandtabbox
dim cmdids(4) as integer
dim texttype(4) as integer
cmdids(0) = cmdgroup.commandid(cmdindex0)
texttype(0) = swcommandtabbuttontextdisplay_e.swcommandtabbutton_texthorizontal
cmdids(1) = cmdgroup.commandid(cmdindex1)
texttype(1) = swcommandtabbuttontextdisplay_e.swcommandtabbutton_texthorizontal
cmdids(2) = cmdgroup.commandid(cmdindex2)
texttype(2) = swcommandtabbuttontextdisplay_e.swcommandtabbutton_texthorizontal
cmdids(3) = cmdgroup.commandid(cmdindex3)
texttype(3) = swcommandtabbuttontextdisplay_e.swcommandtabbutton_texthorizontal
cmdids(4) = cmdgroup.commandid(cmdindex4)
texttype(4) = swcommandtabbuttontextdisplay_e.swcommandtabbutton_texthorizontal
bresult = cmdbox.addcommands(cmdids, texttype)
dim cmdbox1 as commandtabbox = cmdtab.addcommandtabbox
redim cmdids(5) 'very important that no as... declaration is made here!
redim texttype(5)
cmdids(0) = cmdgroup.commandid(cmdindex5)
texttype(0) = swcommandtabbuttontextdisplay_e.swcommandtabbutton_texthorizontal
cmdids(1) = cmdgroup.commandid(cmdindex6)
texttype(1) = swcommandtabbuttontextdisplay_e.swcommandtabbutton_texthorizontal
cmdids(2) = cmdgroup.commandid(cmdindex7)
texttype(2) = swcommandtabbuttontextdisplay_e.swcommandtabbutton_texthorizontal
cmdids(3) = cmdgroup.commandid(cmdindex8)
texttype(3) = swcommandtabbuttontextdisplay_e.swcommandtabbutton_texthorizontal
cmdids(4) = cmdgroup.commandid(cmdindex9)
texttype(4) = swcommandtabbuttontextdisplay_e.swcommandtabbutton_texthorizontal
cmdids(5) = cmdgroup.commandid(cmdindex10)
texttype(5) = swcommandtabbuttontextdisplay_e.swcommandtabbutton_texthorizontal
bresult = cmdbox1.addcommands(cmdids, texttype)
cmdtab.addseparator(cmdbox1, cmdgroup.toolbarid)
dim cmdbox2 as commandtabbox = cmdtab.addcommandtabbox
redim cmdids(2)
redim texttype(2)
cmdids(0) = cmdgroup.commandid(cmdindex11)
texttype(0) = swcommandtabbuttontextdisplay_e.swcommandtabbutton_texthorizontal
cmdids(1) = cmdgroup.commandid(cmdindex12)
texttype(1) = swcommandtabbuttontextdisplay_e.swcommandtabbutton_texthorizontal
cmdids(2) = cmdgroup.commandid(cmdindex13)
texttype(2) = swcommandtabbuttontextdisplay_e.swcommandtabbutton_texthorizontal
bresult = cmdbox2.addcommands(cmdids, texttype)
cmdtab.addseparator(cmdbox2, cmdgroup.toolbarid)
to defeat the wheat, go against the grain.
quick
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|几何尺寸与公差论坛

GMT+8, 2024-12-23 06:24 , Processed in 0.035858 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表