November 23, 200421 yr 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
November 23, 200421 yr 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.
November 23, 200421 yr Author 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?
November 23, 200421 yr 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.
November 23, 200421 yr 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.
November 23, 200421 yr Author 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...
November 23, 200421 yr 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.
November 23, 200421 yr Author 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.
November 23, 200421 yr 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
November 23, 200421 yr 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.
November 24, 200421 yr 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.
November 24, 200421 yr Author 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?
November 24, 200421 yr Just add a script step to Enter Browse Mode at the start of each script - that way you know where it starts from.
November 25, 200421 yr Author 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?
November 29, 200421 yr Author 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.
November 29, 200421 yr 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
Create an account or sign in to comment