Button Bars vs Buttons

I prefer using a Button Bar object with just a single button over using the actual one Button object.
You can set the button title by calculation. This makes it very easy to do dynamic button names.

I had 10 buttons that needed to show dynamic pricing. I made the titles a calculation like this...

TextStyleAdd( "Level 1¶¶" ; Bold ) & TextStyleAdd( "$" & Invoice Charges Products Level 1::Price; Italic)

Now the client can change what is displayed on the buttons rather than contacting me for each price change.

4 Likes

Button bars let one do pretty neat things.

For example say a button is used to trigger some action, but depending on the context this action may not be available. In usual development environments, when the action is not available you would disable the button. But there is no such thing as a disable state for a button in FileMaker. The way you can do it is to replace a button by a button bar with two buttons where only one is displayed at a time. One of the button is the enabled one, the second is the disabled one. The appearance of the buttons are different. Say the button is 32 x 32 px, simply make the width of the "bar" a little bit over 32 px, and make only one of the buttons visible at a time.

What would be the next step, I am not sure if it's on the Claris radar, would be to have layout parts being attached to many layouts. You then would be able to have a bar attached to many layouts without needing to copy and paste between layouts !

3 Likes

Layouts within layouts. Like a web viewer to another layout?

I am thinking about a sub-layout inserted a layout. Microsoft Acces has this, sub-fom in a form. Lets say you have Form1 and Form2, and you insert Form2 inside Form1.

Be cognizant, however, that button bar segments behave differently than buttons. Once clicked and active, you will no longer get the button behaviour until you force the segment to an inactive state. There are tricks to achieve this (such as changing layout and returning)… but a trick is an overhead and extra programming task.

3 Likes

If you set the "Active" segment to something that is NOT the name of an object name of one of the segments... and then use Refresh Object. It will rerender the buttonbar and remove the Active highlight.

7 Likes

I do use button bars a lot - single-segment ones. They have advantages over normal buttons - a bit tricky is the fact that one has to click twice to select (first click select the bar, second click the button), what I forget every now an then...

another way is to use a SVG-graphic and conditional formatting for the inactiv state
I even use layers in SVGs to show different states via conditions

1 Like

How do you access them selectively? Do you play on colour contrast with background to see different icons?

the setup is
one base layer with maybe a basic form like a circle which is always shown

g id="base"
path d="M131.187,19....9.303 z" fill="#E4E4E4"
path d="M451.452,19.303 C418.066,19.303 3...32,142.087 z" fill="#E4E4E4"
path d="M72.763,465...2.763,491.999 z" fill="#E4E4E4"
/g

the second layer holds the icon and can be colorized via conditional formatting or be hidden with color:none for the inactive-state

g id="icon" class="fm_fill" fill="#E49828"
path d="M131.187,19.6..9.652 z"/
path d="M451.452,19.6..80.132,135.436 z"
path d="M72.763,460.481 L343.09...763,492.348 z"/
path d="M236.88,108.349 L15..349 236.88,108.349 z"/
path d="M332.481,172.083 L15...282,172.083 332.481,172.083 z"/
path d="M332.481,235.817 L154.556,235.817 ...17 332.481,235.817 z"/
path d="M332.481,299.552 L154.556,299.55...32.481,299.552 z"/
/g

as you can see the first three paths of the icon-layer cover the same areas as the "grey" base-layer objects

3 Likes

Great tip Josh. Not intuitive, I should add an item to my to-do list: "ask claris for a reset buttonbar script step"

1 Like

It seems to be a minor issue with the pixels not being triggered to redraw. Anything that causes the window to redraw triggers it to refresh.

I don't know how other people handle the problem of having blank buttons when you have selected any of the display icon options. I do it with an SVG.

Cut and paste the code below into a text editor and save as "fmp_blank.svg" ( or whatever makes sense for you ) then switch to FileMaker and import it into your file via the button bar icon dialog.

<?xml version="1.0" encoding="utf-8"?> 
<svg version="1.2" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" 
	 x="0px" y="0px" width="24px" height="24px" viewBox="0 0 24 24"> 
<path /> 
</svg>
1 Like