Transcription

Lesson 8 will focus on Buttons and Button Bars in FileMaker. There are two different kinds of objects you can put on a layout – these are Buttons and Button Bars. Button Bars are slightly different than Buttons. Buttons are single objects, and they have four states – there is the normal state, hover state, pressed state and an in-focus state. The in-focus state is basically when you tab to something and it is slightly highlighted. Button bars also have the same states, only the normal state is called “inactive.” Then there’s hover, pressed and active.

The two different kinds of Buttons, called Button and Popover Button. When you’re in Layout Mode and you want to put a Button on the layout, you have to choose either a Regular Button or a Popover Button. You can put layout objects on that Popover or Regular Button, it just fires a script or scripts.

Button Bars can also be either a Popover or a Button. If you go into Layout Mode, notice you can actually switch back and forth. When we double click on this Button Bar segment, you’ll see on the tool palette that you can actually choose either a Button or a Popover Button. You’ve got a Popover and you can choose which direction you want it to pop. You can choose the title bar, or you can choose to not show a title bar at all. I don’t usually like to have a title bar. However, with a Button you can’t actually switch back and forth – you have to choose one or the other. If you decide partway through your development that this Button really should be a Popover, you actually have to go up to here and choose Popover Button and Make New Button and now it’ll be a Popover Button.

When you do make a new button object, you’ll always have that Pilot. It can just be an icon of some sort, it can be an icon with text, or it can be an icon with text on one side or the other. In this case, we’re just going to use text. I’m not going to get into icons and their usage yet. One of the other main differences between Buttons and Button Bars is that while a Button has four states – normal, hover, pressed and in-focus, and button bars have active, inactive, hover, pressed and in-focus. Active means you’ve pressed it.

When you double-click to edit this button bar, you’ll notice that you have to choose one segment to be active. This would normally be used for like a navigation bar, so, in this case, if we imagine that this is a navigation bar, we go back into Browse Mode. We’re on the People layout, so when you click People, nothing’s supposed to happen. I want to go to Invoices. Click on that and now you have a similar Button Bar, only in that one the active button is the Invoices button, because now you’re on a different screen. That’s typically what the active state would be used for.

If you’re not using this as a navbar, and just using it to run scripts, you probably don’t want to have an active state. In that case, go to the active state and design it to look like the other states, so there is no active state. The other main difference between Buttons and Button Bars is the text that you can have on a Button Bar. This is one of the Button Bar’s strengths. When you double-click, you can use the full power of the calculation engine to calculate anything. For example, put a function like Get Current Date. That Button Bar will have the date as the label, or I can have a field – let’s say it’s the Full Name field, and anything else you could do with the calculation engine you can put here.

You can use merge text on a Button Bar, which is what I’ve done here. You can insert anything you want into a merge field or merge variables. You can actually place this in the label of the Button Bar, but that’s about all you can do with calculated text. The main difference is if you put a variable in and merge that variable, you’d have to run a script to create that variable, and then refresh the screen before you actually see the label. The Button Bar, however, will dynamically calculate that every time you refresh the screen. In fact, anytime data changes, the label on your Button Bar will change. It’s a very powerful feature.

One of the other key features of Button Bars is if you want to make one of these buttons invisible, use Hide Object. We’ll just say True for now, which means that this is going to be invisible when I go back in the Browse Mode. Now you’ve got a gap where there used to be a Button, and now there’s no Button. If I wanted to make this Button segment invisible on a Button Bar, I would hit True and I go into Browse Mode. Now we see that the segment disappears, but the length of the button bar actually stays the same and fills in the gap. On any given screen you can have inversely hidden objects, where one is invisible and the other is not visible.You can actually have multiple Button segments doing different things, and make certain ones invisible when some condition exists so that becomes a really powerful tool as well.

Another cool thing about Button Bars is if you click and hold on a segment in a Button Bar, you can actually drag it around. You can actually delete segment just by hitting the Delete key. If I hit Command C or Control C on the Windows, I’ve copied this segment and I can paste the segment. Now I’ve got a whole new button bar! If I wanted to add a new segment, I can just click Plus.

The final powerful feature of Button Bars is using dynamic text for a layout. I often use Button Bars solely because they have dynamically calculated text. Perhaps I wanted to show some text on the layout that was supposed to be not editable, and to calculate something dynamically as well. What I might do is actually take this style, choose one that’s invisible, so you can see when I click off it just looks like text sitting on the screen, but it’s actually a Button Bar. If I double click this, and I have nothing attached to it, no script steps no scripts, now they won’t have a hover state – it won’t change. When I hover over it, it’s got nothing to do and nowhere to go – it’s now essentially just a piece of calculated text. I might make the alignment to the left and oriented towards the top left, and now if I go into here and calculate the text, I might put sales and this person and paragraph, and I can put this display text. When I go back into Layout Mode, I can see now this is just calculated text essentially displayed on the layout. When we go into Browse Mode, it just looks like text. You can’t select it, you can’t accidentally edit it – it’s fixed text, and you anything that you can calculate can be placed on a layout in a Button Bar segment. That’s not actually a Button because it doesn’t do anything, it’s just used for the calculation engine. This is a super useful feature of Button Bars and I use it all the time.

We can see this calculated value because I have a setting in FileMaker under the View Menu that says Show Sample Data. If you don’t, the default setting for FileMaker is to not show sample data, so when you make this a calculation in Layout Mode, you can’t actually see what it’s calculating. When you go into Show Sample Data, it’ll now show you what it’s calculating. This is the same for fields. Say we have this Full Name field on the layout – when we view sample data you’ll actually see the data that’s in the field. If I turn off sample data now I see the Field Name. Most people using FileMaker will design their layouts with field names so that the Button Bars just say Calculation, but I frequently switch to Sample Data, so that I can see what’s being calculated in Layout Mode.

That’s about it for Button Bars and Buttons. I find Button Bars super useful – I use them all the time. You may find that you there are certain strengths of regular Buttons and certain strengths of Button Bars. I would encourage you to a comment down below and let us know which one you prefer, and any special techniques you found with one or the other.