Steve S Posted October 8, 2004 Posted October 8, 2004 I have 2 layouts using the same TO. Layout A is list view and Layout B is form view. I made the fields on Layout A buttons to switch to Layout B. What happens is when I click a field in the list, the record actually gets selected before the button kicks in to switch the layout, so I get a desired result. I get to view Layout B on the record I clicked on when viewing Layout A. OK. So I want to do the same thing, but instead of just switching layouts, I want to open a new window for Layout B. I can get this done, but it does not go to the selected record. I have tried related records, but it doesnt work because both layouts are from the same TO. I could maybe make a self join with another TO and relate it, but I'm hoping to avoid this as I have a few other relationships going on I would have to reorg. Seems to me there must be a simple solution to this. Thanks!
transpower Posted October 8, 2004 Posted October 8, 2004 Have a form view button and a table view button in the header for both layouts. Just click the desired button to switch. Use the View As script step.
Steve S Posted October 8, 2004 Author Posted October 8, 2004 thanks transpower, but maybe I wasnt specific enough. I want to work with just 2 windows here. I want to avoid the user opening more then two windows. So lets say I have a Form layout called "Form A" viewing in a window titled "Test A" I have a List Layout called "List B" in a window titled "Test B" If I click on a button on "List B" in window "Test B" I have a quick check done via a script. Select Window [Name: "Test A"] If [Get (Window Name) = "Test A"] Go to Layout ["Form A"] Else New Window [Name: "Test A"] Go to Layout ["Form A"] End If this will ensure that the button will trigger the "Test A" window and make it active, or if it is not open all ready to create a window with this name. i have a similar script going the other way. this way we are working with just two windows. This works great. My problem is this. When clicking on the record in "List B"(the whole record space is a button that triggers above script) it goes to window "Test A" to layout "Form A" but it does not go to the record I clicked on. That is what i am trying to do. I have tried alot of things. I even made the self-join TO and that works by going to related record and clicking the "open in new window" option, but that does not let me have the above check taken into account. So I can't limit it to two windows. What i was hoping to find is some extra line in the script that would allow this to work. Again, any help would be appreciated.
Steve S Posted October 8, 2004 Author Posted October 8, 2004 Queue, thanks much. This definitley functions as i would like it to. Now i don't mean to be picky, I just am made that way. If set up like this you get this ugly flash when the the "Test A" window closes and then reopens. It works.. it does just what I want it to do, but being that people will be using this step very very often I wish there was a way to accomlish the same results without the closing/reopening of the window. For no other reason then it is ugly. very ugly. But thanks again. That's a pretty clever solution
transpower Posted October 8, 2004 Posted October 8, 2004 OK--you don't seem to want to close/open windows. So, again, why not just use the View As script step?
Steve S Posted October 8, 2004 Author Posted October 8, 2004 Because the "view as" fuction will chage the view on the current active window. I want to activate a second window, and then go to the selected record there. I don't want the original window to change at all. My actions in the window "Test B" should affect what happens in window "Test A" so to speak.
-Queue- Posted October 8, 2004 Posted October 8, 2004 I don't know why I used the Set Window Title step when you can set that in the GTRR step. But anyway... I think you may be stuck with setting the id to a global, then doing a find in the other window. There doesn't seem to be a natural way to link the two otherwise.
transpower Posted October 9, 2004 Posted October 9, 2004 Then why not: Menu Bar | Window | New Window
-Queue- Posted October 9, 2004 Posted October 9, 2004 Please, don't be so vague. Elaborate on your thoughts so we have an inkling of what you mean.
transpower Posted October 9, 2004 Posted October 9, 2004 Queue: I assume you're asking the original poster. One of the nice things about FMP 7 is this capability to see multiple records of the same database on the screen, using the menu command I gave.
Steve S Posted October 9, 2004 Author Posted October 9, 2004 Transpower. I think you are missing what I am trying to accomplish here. I can open a new window with no problem. I can open two or more windows simutaneousl no problem. Manually or with a script. Using the menu command you suggested above does this fine. What I cannot do(neatly) is this. Have two windows open side by side. You can use any of your above suggestions to get these open. On the window to the left go to a record. Have a button on this window that will activate the other window to the right(which is all ready open - this is the tricky part) and have it automatically go to the record I was viewing in the first window. Now, using related records and a self join I can open a new window and have it jump to the related record. But I can't accomplish this if the window is all ready open. Queue had a great suggestion above that works, but if you put it into practice you can see it's pretty flashy/ugly. Not very neat looking. I can get it to work using a global field/find as Queue also suggested, but that's also a sloppy way of doing it. I was hoping for something a bit neater. As it is, my script is pretty ugly But again, I appreciate all the input
bruceR Posted October 10, 2004 Posted October 10, 2004 Why should the script be ugly? Seems simple enough. Set a global to current record ID. Get yourself into the other window. Go to related record by global. Aside from the window switching is should take what, 2 steps?
Steve S Posted October 10, 2004 Author Posted October 10, 2004 it's easy to answer one point and forget to reiterate the other points I mentioned earlier. I'm trying to keep the users confined to two active windows. So I'm also checking it the window is all ready open This is what my script looks like today. It's triggered off a button. I'll use the FormA layout on WindowA and ListB layout on Window B example all on TO1 Set Field [ TO1::Globalholder; TO1::PK_Record_ID] Select Window [Name: "WindowA"] If [ Get ( WindowName) != "WindowA"] New Window [Name "WindowA"; Top 0 ; Left: 0] End If Go to Layout ["FormA" (TO1)] Enter Find Mode [] Set Field [TO1::PK_Record_ID; TO1::Globalholder] Perform Find [] Show/Hide Status Area[show] Select Window [Name:"WindowB"] in the if statement that '!=' is a 'not equal to' sign. I can get figure how to display that font. The reason I cant just do a 'perform find' seems to be because of the Global field. It's simply greyed out when I try to set the equation. I can't use it so have to do the find in 3 steps. And maybe add a 'Show All Records' step at the end. Cause I think I may need to add it to get out of the found set. Anyway, it does work. And yes, I think it's ugly. And I really don't like that I have to use trickery to do a seemingly simple task. But that is ok. FM7 still rocks. I was just asking
Steve S Posted October 10, 2004 Author Posted October 10, 2004 I just reread what you wrote ralph. I am a bit tired here, but I'm not grasping how to go to the related record via the global? I dunno. Lemme sleep on it. i'll see in the morning
bruceR Posted October 10, 2004 Posted October 10, 2004 But why do a find? Set up a relation from the global field to the record ID and go to the related record.
Recommended Posts
This topic is 7352 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