Back Button / Dimmed Buttons Script
Visitors to VTC.com will be able to view all introductory videos for each training course.
Free Trial Members will gain access to first three chapters for each training course.
Full Access Members have full access to VTC.com’s entire library of video tutorials.
Learn More
Subtitles of the Movie
Now that you've replaced the Back and Forward buttons with related fields that will display graphics from a related table and place those on every layout, we're now ready to add the scripts that will update those buttons. So let's go into ScriptMaker, and we'll start with our open script. You don't want to forget this one. It's going to need two Set Fields in here. The first one's going to set the X Back field to the word Dimmed. That's because when we first opened up this solution, when a user opens up the solution, we want to make sure that it's dim, because they won't have navigated anywhere. We want to make sure that if the developer left a value in that field and it said something else like Back, that it comes up dimmed when they first launch it. It's a good idea to initialize these fields. So we'll do the same thing also for X Forward. This way, the right status will be displayed in those buttons right when we open the file. So we'll save that. That one was easy. And now we can go to our Back Store. All we need are a couple of Set Fields here. Now if you remember back from previous sections, I said I was going to disable these because I don't want the Back Record, Back Window, and Back File; I don't really like them. They're still in here in case you want them, but I've disabled them. So now at the end, we're going to put in some set fields, and the first set we feel we're going to do is for X Forward, and we're going to set to Dimmed. So why are we going to set this to Dimmed? Well, any time we navigate somewhere else through one of the tabs or through the menu button, there's going to be no History and Forward; it's automatically erased, if you remember that from the previous section. So just set it to Dimmed every time we run this. So every time we run a navigation to a layout, it's going to call Back Store, which is going to go ahead and set that X Forward to Dimmed and make the relationship show the Dimmed button. And then we'll also set X Back, and we'll put in the word Back. Now we don't need to test for whether it is Dimmed or Back at this point, what status it is, because if we hit a navigational button, we're definitely going to get history. So even if there's already a Back in that X Back field, it says the word Back, we'll just put it right over itself. There's no reason to test it. We could have put in some kind of Case Statement in here, but it really would have just have slowed things down. Just put Back right in the same place. There's no reason to do anything else. So we'll go ahead and close that. We're done with this script. Now we can go on to our Back Navigate, and again, we have a lot of Dimmed steps in here. And I'm going to put another Set Field right here. Now it doesn't necessarily have to show up in this spot, but I like it because it goes along with the step before it, dollar sign, dollar sign, Forward. So we're going to come in here, and we're going to say, Set the X Forward field, and we're going to set that to the word Forward. The reason we're going to do that is because if we hit the Back button, we're definitely creating History in the Forward section. So no matter what it is at this point, if we already have the Forward button there, we're just going to recreate. You're going to write right over the same Forward, but if it's dimmed, Forward's going to take over for the Dimmed, and that button's going to show that there's History in the Forward. And now we'll go down to after this set variable, and we'll do another Set Field, and we're going to get into the X Back field. What status do we set this to? Now this is the most complicated one we've done so far. The formula is a little more complicated. It's really not that hard. It's just Case, open parentheses, is empty, dollar sign, dollar sign, Back, close parens. So if there are no more values in the history, then we want to go ahead and set it to Dimmed. Otherwise, set it to Back. Simple. Now it is very important that this go in the right place. It has to go right here um, rather than before. You need to make sure that you've taken the values out of Back before you try to set the status. So you can't put this Set Field up here. It has to go down here after this. And then we're done, but we're going to add these similar steps into Forward Navigate. So we'll Command click or Control click these two so we get them selected, and then we'll copy. If you have a FileMaker 8.5 or earlier, you'll have a Copy button down here if you have Advanced. Otherwise, you need the keyboard command. So I did that. We'll close that and save it. Go down to Forward Navigate, click right there, use the keyboard command to paste, move this down into the right spot, and then we'll change these. Just simply reverse them. Change it from X Forward to X Back. Change this to the word Back, and then come down here and do the same here. Change this to X Forward and then change the formula. Dollar sign dollar sign, Forward. Dimmed is good, and we'll change this to Forward. And we're all done. We're ready to test this out so we'll close this up, save it. And now we don't have any values in here because we haven't navigated anywhere. So the first time we navigate, we're going to see values appear there. And so you see now we've got history. We can see that this is available and this is dimmed. We can even go one more place. We'll see this is still available and this is dimmed. And as soon as we hit Back, then this one becomes available, and then if we hit Back again, this one becomes dimmed. Oops. Looks like we had one more in there, couple more in there, quite a few it looks like. So it looks like it had some stuff already in there from working around with it, but eventually once you get through, all the values were stored there, all the back history, it will dim out. So now if we go ahead and hit Forward, it'll come back; hit Back, it'll disappear. Let's see how this works. There we go. Dims out. So. Don't get fooled. This is actually a good little exercise to come across. Don't get fooled by something you might have done previously. Remember and take a look at the data. I just happen to know that I had navigated around and almost fooled myself into thinking that it really wasn't working here, but then I remembered, Oh yeah! I've been navigating around and I forgot that I hadn't cleared those out. So if I'd gone into the Date Viewer and cleared them out, then we'd have had a better example, but actually, I like this, because you just got to be on your toes all the time in FileMaker. Don't get fooled and think that something doesn't work when it actually does and it's just about the data. You often get fooled by the data. Make sure the data's correct, and then if your data's correct, then you'll likely find out that actually your script was working. So you know, it's a hard thing. You've got to, you've got to just experience these things, fall into the hole several times before you realize to walk around it, and so some of these things that you experience just have to happen to you and then you'll just remember, Oh yeah, I'm not going to do that again, ah, Or maybe this happened in this situation like it did before. So its just experience is what it comes down to.
Tutorial Information
| Course: | FileMaker Pro 9: Advanced |
| Author: | John Mark Osborne |
| SKU: | 33824 |
| ISBN: | 1-934743-32-1 |
| Release Date: | 2007-11-21 |
| Duration: | 10 hrs / 115 lessons |
| Work Files: |
Yes |
| Captions: | For Online University members only |
| Compatibility: |
Vista/XP/2000, OS X, Linux QuickTime 7, Flash 8 |
VTC Sign up & Benefits
- Unlimited Access
- 98,729 Video Tutorials (23,265 free)
- Video Available as Flash or QuickTime
- Over 1026 Courses
- $30 for One Month Access
- Multi-User Discounts Available
United States 