How to dock one commandbar next to another one

J

Julie

I've created 2 custom commandbars, cb1 and cb2. At startup, I would like cb2
to dock next to cb1, but it always seem to want to dock below it. I cannot
figure out how to do this. I've tried:

cb1.RowIndex = cb2.RowIndex + 1;

That did not work. I've also tried determining the exact position where cb1
is docked and setting the exact pixels:

cb2.Top = 50;
cb2.Left = 46;

But that didn't work either -- it docked in the correct position (cb2.Left),
but it is still docked a row below cb1. Can someone please tell me how to
dock cb2 to the right of cb1? Thanks much!!!
 
C

Cindy M.

Hi =?Utf-8?B?SnVsaWU=?=,
I've created 2 custom commandbars, cb1 and cb2. At startup, I would like cb2
to dock next to cb1, but it always seem to want to dock below it. I cannot
figure out how to do this. I've tried:

cb1.RowIndex = cb2.RowIndex + 1;

That did not work.
Theoretically, they'd have to have the same .RowIndex (in other words, don't
use +1, above). However, getting commmand bars to "anchor" in a particular
place is a lottery, at best.

I agree with XLDennis: why not use just one command bar?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
J

Julie

Cindy M. said:
I agree with XLDennis: why not use just one command bar?

The short answer, is yes, I can have 1 command bar. But logically, for my
app, it is better to have 2. My first command bar is part of the add-in. It
has buttons like "new, open, save" for my type of spreadsheet. When they
click on new, they would get a special VSTO spreadsheet, which has it's own
command bar for interacting with my type of spreadsheet. I wanted the VSTO
toolbar to dock next to the add-in toolbar. Instead, it always docks below,
even though there is ample space next to the add-in toolbar. With these two
toolbars, plus whatever Excel toolbar I already have, I wind up with lots of
real estate wasted on toolbars!

Anyway, I will probably just consolidate and do with one tool bar if the
answer is that I cannot dock beside. My preference is to have the toolbars
separate, but real estate space is more important than that.
 
C

Cindy M.

Hi Julie,

Ah, yes, it would be useful to have two of them. You've tried setting the
.RowIndex of each to the same value (+1 would definitely put it in the next
row)?

The other possibility would be to have the VSTO project look for the Add-in
command bar and, if it finds it, add its (temporary) controls to that. And
remove them when it closes. Put a "Separator" between the two sets of controls
to make it more visually obvious that the user is dealing with two buttons for
two different things.
The short answer, is yes, I can have 1 command bar. But logically, for my
app, it is better to have 2. My first command bar is part of the add-in. It
has buttons like "new, open, save" for my type of spreadsheet. When they
click on new, they would get a special VSTO spreadsheet, which has it's own
command bar for interacting with my type of spreadsheet. I wanted the VSTO
toolbar to dock next to the add-in toolbar. Instead, it always docks below,
even though there is ample space next to the add-in toolbar. With these two
toolbars, plus whatever Excel toolbar I already have, I wind up with lots of
real estate wasted on toolbars!

Anyway, I will probably just consolidate and do with one tool bar if the
answer is that I cannot dock beside. My preference is to have the toolbars
separate, but real estate space is more important than that.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
J

Julie

Cindy M. said:
Hi Julie,

Ah, yes, it would be useful to have two of them. You've tried setting the
.RowIndex of each to the same value (+1 would definitely put it in the next
row)?

Ah yes -- that's it! I've misinterpreted the meaning of "RowIndex", and
thinking it was more of a RowOrder, hence I put the "+1". Once I made the
RowIndex the same between the two toolbars, it did work.
The other possibility would be to have the VSTO project look for the Add-in
command bar and, if it finds it, add its (temporary) controls to that. And
remove them when it closes. Put a "Separator" between the two sets of controls
to make it more visually obvious that the user is dealing with two buttons for
two different things.

This sounds like a good solution too, although a little more clunky codewise
to remove all of the buttons individually on close.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top