vilem Posted November 23, 2004 Posted November 23, 2004 Hi, I,m trying to make a Go Back script that is going to be attached to a Back button but for some reason it acts very weird AKA sometimes when I'm on a layout in preview mode it will turn the layout in browse mode... Err ok I found out why, it was pretty dumb on my part... Here's my script: Allow user abort(off) Go to layout (original layout) Enter browse mode Toggle window maximise The back button doesnt go back at all, it always stays on the same layout. How can I make the back script to go to the previous layout AND enter the default mode of that layout? Thanks
transpower Posted November 23, 2004 Posted November 23, 2004 This is actually a fairly advanced topic. It's discussed on pp. 362-366 in Chapter 13 of Using FileMaker 7--sample code is shown on pp. 364-365. I imagine that it would be even more involved to do in version 6.
vilem Posted November 23, 2004 Author Posted November 23, 2004 Are you serious? I was under the impression that I was just being really dumb and that it was a fairly simple script...Time to buy some books and start reading! Aside from Using Filemaker 7, is there any other great books about FM7?
transpower Posted November 23, 2004 Posted November 23, 2004 I assumed you meant a real "Back" button--which would take you all the way back to the beginning of a session, regardless of how many layouts, tables, etc. you went through.
-Queue- Posted November 23, 2004 Posted November 23, 2004 Go to Layout [original layout] refers to the current layout when the script was called. You would have to store the desired layout number in a global and use the 'layout number from field' option.
vilem Posted November 23, 2004 Author Posted November 23, 2004 Thanks, it partially works now. It always brings me back to the same layout. Let's say I have 6 layouts, A,B,C,D,E,F If I go from A to D and hit back, it brings me back to A no problem. But it always brings me back to A no matter if I was on F and went to B... I have my global field named Last Layout and set to "number" and in my "Go Back" script, I have Go To Layout ("Last Layout") specify: layout number from field I'm having a hard time trying to find out whats wrong...
-Queue- Posted November 23, 2004 Posted November 23, 2004 You have to set the global via script every time you change layouts and want to make 'this' layout the one to which it should return.
vilem Posted November 23, 2004 Author Posted November 23, 2004 Do you mean calling: Set Field(Last Layout) on each of my scripts that allow me to change layouts? Maybe I'm calling the wrong value (Last Layout) but I just tried it and it doesnt work.
Dan-A Posted November 23, 2004 Posted November 23, 2004 I have a global text field: gt_sys_CalledFrom I use a set field step to give it the layout name that i am about to leave (to go forward)...set field calledFrom to CalledFrom & ScriptParameter & "@" (the layout name is passed by the script parameter. Then when i want to go back, i just find the last pair of "@" and use a gotoLayout by name calculation to return to the proper layout. I then remove the last layout name, so that nested "go backs" will work Dan
-Queue- Posted November 23, 2004 Posted November 23, 2004 I mean using Set Field [globallayoutnumber, Status(CurrentLayoutNumber)]. You could also use Dan's technique to track multiple layout changes, but you would not be able to use the script parameter. You could, however, use Status(CurrentLayoutNumber) or Status(CurrentLayoutName) to set a global text field appropriately.
transpower Posted November 24, 2004 Posted November 24, 2004 Vilem: So your problem was much simpler than I imagined. Just do as -Queue- says above. In the future, if you need a real Back button to travel back through all the user's choices, see the reference I gave.
vilem Posted November 24, 2004 Author Posted November 24, 2004 I ordered Using FM7 this very morning! Almost everything works now, I am able to go back to the previous layout no problem, there's one itch though, when I'm on a layout that is in preview mode and I decide to go back to a layout that is supposed to be in browse mode, it unfortunately puts it in preview mode. Do I have to store the layout mode in a different global field as well?
DykstrL Posted November 24, 2004 Posted November 24, 2004 Just add a script step to Enter Browse Mode at the start of each script - that way you know where it starts from.
vilem Posted November 25, 2004 Author Posted November 25, 2004 Attach Enter Browse Mode to each of my scripts that enables me to navigate through my layouts? How would that effect my back button since the only thing that the back button makes is going back to the previous layout. It doesn't execute the usual script that makes me switch from a layout to another. The way I see it at the moment is that I would have to give my back button a series of conditions like: If my previous layout is Labels then enter preview mode... But there must be some way to simplify this, like I asked a few posts up, is it possible to "store" the mode of a layout in a global field just like I did for the layout?
transpower Posted November 26, 2004 Posted November 26, 2004 Sure: use the Get(WindowMode) function (in 7) or Status(CurrentMode) (in 6).
vilem Posted November 29, 2004 Author Posted November 29, 2004 Ok I'm beginning to understand FM scripting, So I've setup my go back button and it works fine now, it brings me back to the previous layout I've also setup my global field in which I store the mode of the layout, I have also put the Set Field in the appropriate scripts. Only 1 problem remains, how do I call that field in my go back button script? Calling the layout number was fairly easy, I only had to make the script go to the layout "globallayoutnumber", but I cannot find the equivalent script for the layout mode.
-Queue- Posted November 29, 2004 Posted November 29, 2004 You don't call the field, you test its value. If [not globalfield] {window mode is zero - Browse} {do something} Else If [globalfield = 1] {window mode is one - Find} {do something else} etc. End If End If
Recommended Posts
This topic is 7302 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now