"Go To Layout" NOT working properly
I believe this is a bug in FM, b/c it happens to me often. But I have now experienced it in the FM Training Series, lesson example 6.4.1.
It has you created a script that opens a new window. Here is the script (taken directly from the above lesson):
Allow user Abort [Off]
Set Variable [$group; Value:GROUP::__kp_Group]
New Window [Name: "Select Person"; Height: 500; Width: 250; Top 50; Left: 200]
Go to Layout [“Person_Picker” (PERSON)]
Show/Hide Status Area [Lock; Hide]
Show All Records Sort Records [Restore; No dialog]
Go to Record/Request/Page [First]
Set Variable [$result; Value: Get (ScriptResult)] If [$result > 0 and $result ≠ “Cancel”]
Go to Layout [“dev_PersonGroup” [PERSONGROUP)]
Set Field [PERSONGROUP::_kf_Person; $result]
Set Field [PERSONGROUP::_kf_Group; $groupID]
Close Window [Name: “Select Person”; Current file]
I am using FMProAdv11, so I can run the debugger. When it runs the script it goes to "Go to Layout [“Person_Picker” (PERSON)] " fine with the proper (and wanted) view as form, but in the very next step (Show/Hide) it jumps to "Table" view (even when "Table View" is disabled in the Layout Setup).
I did look at the "dev_PersonGroup” layout at one point & changed views. But I can't believe this would change something so fundemental. Even if I go back to the layout & make sure I switch to Form View before closing the Layout, it STILL does this goofy thing. And I didn't go into Layout Mode, I just changed the View. When I open the above Layout from "Manage Layouts" it goes to Form view, because the default view is set to Form View. This seems to only happens when running from a script.
This has happened in MANY situation in OTHER FMDBs I've worked on. What is the problem?