Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Ribbon in Excel 2007: positioning buttons using box controls

45 views
Skip to first unread message

Paul Martin

unread,
Dec 20, 2009, 11:42:47 PM12/20/09
to
I'm trying to position 5 buttons in a group:
2 vertically on the left, 2 vertically on the right, and one below.

The code below places the last button on the far right and I'm
wondering what I can do to fix this. I realise that I can set the
boxStyle to horizontal and rearrange the buttons, but I'm trying to
keep them grouped in a logical fashion as above. If all else fails, I
will revert to this, but I would have thought there'd be a solution.
Any suggestions appreciated.

Thanks in advance

Paul Martin
Melbourne, Australia

Paul Martin

unread,
Dec 20, 2009, 11:50:30 PM12/20/09
to
I forgot to post my code:

<group id="Import" label="Import">

<box boxStyle="vertical" id="box1">
<button id="buttonL1" label="Left Top" onAction="DoSomething"/>
<button id="buttonL2" label="Left Middle" onAction="DoSomething"/>
</box>

<box boxStyle="vertical" id="box2" >
<button id="buttonR1" label="Right Top" onAction="DoSomethingy"/>
<button id="buttonR2" label="Right Middle" onAction="DoSomething"/>
</box>

<button id="buttonB" label="Bottom" onAction="DoSomething"/>

</group >

Andy Pope

unread,
Dec 21, 2009, 8:37:14 AM12/21/09
to
Hi,

This forces the middle button to the third row. Remove label items if you
want to raise the middle button.

<!--RibbonX Visual Designer 1.7 for Microsoft Excel. XML Code produced on
2009/12/21-->
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" >
<ribbon >
<tabs >
<tab idMso="TabHome" >
<group
id="Group1"
label="Group1">
<box
boxStyle="vertical"
id="Box1">
<button
id="Button1"
label="Top Left"/>
<button
id="Button2"
label="Bottom Left"/>
<box
boxStyle="vertical"
id="Box2">
<labelControl
id="Labelcontrol1"
label="Labelcontrol1"
showLabel="false"/>
<labelControl
id="Labelcontrol2"
label="Labelcontrol2"
showLabel="false"/>
<button
id="Button3"
label="Middle"/>
</box >
<box
boxStyle="vertical"
id="Box3">
<button
id="Button4"
label="Top Right"/>
<button
id="Button5"
label="Bottom Right"/>
</box >
</box >
</group >
</tab >
</tabs >
</ribbon >
</customUI >

Cheers
Andy
--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"Paul Martin" <melbou...@gmail.com> wrote in message
news:695fa620-6f06-48b9...@j24g2000yqa.googlegroups.com...

Paul Martin

unread,
Dec 22, 2009, 7:08:15 PM12/22/09
to
Thanks Andy, but that doesn't quite solve the problem. Or, it solves
one but creates another, because it spreads the width of the group by
inserted a middle column. Effectively, that XML creates 3 columns,
each 3 rows. What I want is 2 columns that are each 2 rows, with a
single row (but 2 columns wide) underneath in the third row.

You did get me thinking about boxes and I thought the code below would
solve the problem, but it doesn't. It still places the final button
into a third column. What this code attempts is to put the two
vertical boxes into a horizontal box, with a button below that (and
putting the button into a box does nothing, as you'd expect).

Any other suggestions?

Paul

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/


customui">
<ribbon>
<tabs>
<tab idMso="TabHome">

<group id="grp1" label="Test">

<box boxStyle="vertical" id="box1">

<box id="box2">
<box boxStyle="vertical" id="box3">
<button id="btn1" label="Top L"/>
<button id="btn2" label="Mid L"/>
</box>

<box boxStyle="vertical" id="box4">
<button id="btn3" label="Top R"/>
<button id="btn4" label="Mid R"/>
</box>
</box>

<button id="btn5" label="Bottom"/>

Paul Martin

unread,
Dec 22, 2009, 7:40:04 PM12/22/09
to
As an aside, I've been playing around with Button Groups and Buttons.
Inserting 3 Button Groups "sort of" addresses the problem by placing
the buttons in roughly the configuration I'm after. But there's two
drawbacks:
1). The RHS buttons on the top and middle rows are not left justified.
2). The buttons appear with the button image.

1) could be fixed by buffering the LHS with spaces. Not ideal, but it
would do the trick.
2) doesn't seem to have any workaround.

All-in-all, this is not an adequate solution, so... I'm still looking.

Andy Pope

unread,
Dec 23, 2009, 4:03:02 AM12/23/09
to
Try this, still a work around.

3 horizontal boxes within a vertical box.
Rather than padding the buttons with leading spaces I used a label control
to pad the area between the buttons for the top and middle section.
For the Bottom section the labels pad around the button to center it.

<!--RibbonX Visual Designer 1.7 for Microsoft Excel. XML Code produced on

2009/12/23-->


<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" >
<ribbon >
<tabs >
<tab

id="Tab1"
label="Tab1">


<group
id="Group1"
label="Group1">
<box
boxStyle="vertical"

id="Box1a">
<box
boxStyle="horizontal"
id="Box2a">


<button
id="Button1"
label="Top Left"/>

<labelControl
id="Labelcontrol1"
label=" "/>
<button
id="Button2"
label="Top Right"/>
</box >
<box
boxStyle="horizontal"
id="Box3a">
<button
id="Button3"
label="Middle Left"/>
<labelControl
id="Labelcontrol2"
label=" "/>
<button
id="Button4"
label="Middle Right"/>
</box >
<box
boxStyle="horizontal"
id="Box4a">
<labelControl
id="Labelcontrol3"
label=" "/>
<button
id="Button5"
label="Button Across Bottom "/>
<labelControl
id="Labelcontrol4"
label=" "/>
</box >


</box >
</group >
</tab >
</tabs >
</ribbon >
</customUI >

Cheers
Andy

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"Paul Martin" <melbou...@gmail.com> wrote in message

news:54b2aa43-f046-49ec...@21g2000yqj.googlegroups.com...

Paul Martin

unread,
Jan 3, 2010, 6:31:18 PM1/3/10
to
Thanks, Andy (and happy new year - I just got back from my holidays).
I think your suggestion might suit some who come looking for a similar
solution, but it's a bit messy for me because:
1). The padding can emulate left justification for the RHS buttons but
is fiddly
2). I wanted to group certain buttons together, which this doesn't do.

In the end, it's easier just to add the buttons without any boxes so
that the first two are vertically adjacent, the bottom button is below
that and then the next two buttons are automatically in the next
column, also vertically adjacent. It seems a pity that there's not
better control over the placement of the buttons.

Thanks again

Paul

0 new messages