mfl Posted January 19, 2010 Posted January 19, 2010 Still new to FM. I have this application and am trying to make a popup window work. This popup window code is being used in another layout which basically has a user clicking a button on the layout and it pops the window. The problem is that on execution the sequence blows right through the pop and displays the wrong layout in the popup. The first bit of script is the main one that runs when the user clicks the required option button. 0002 - New Compliance Request Allow User Abort [ On ] Set Error Capture [ On ] Freeze Window #Start by asking user if they want to view current compliance reports for selected facility or create a new one. Perform Script [ “Form Selection Window” ] Show Custom Dialog [ Title: "Compliance"; Message: "Do you want to VIEW compliance reports for this facility or CREATE a new one?"; Buttons: “New”, “View” ] If [ Get ( LastMessageChoice ) = 1 ] If [ Get ( ScriptParameter ) = "SGS" ] Commit Records/Requests [ No dialog ] Perform Script [ “Set Zoom” ] New Record/Request Else Set Variable [ $plantid; Value:Plant::PLA_PlantID ] Set Variable [ $$factory; Value:Profile::PRO_ID_Profile ] Set Variable [ $$facility; Value:Plant::PLA_Facility ] Set Variable [ $$compID; Value:Plant::PLA_Comp_Count + 1 ] Set Field [ Compliance::CP_ID_Profile; $$compID ] // Set Field [ Plant::PLA_Comp_Count; $$compID ] Commit Records/Requests [ No dialog ] Go to Layout [ “Compliance Entry Screen” (Compliance) ] New Record/Request Go to Field [ Compliance::CP_audit# ] Set Field [ Compliance::CP_ID_Serial; $$factory ] Set Field [ Compliance::CP_ID_Profile; $$compID ] Set Field [ Compliance::CP_Facility; $$facility ] Set Field [ Compliance::CP_ID_Plant; $plantid ] End If Else If [ Get ( ScriptParameter ) = "SGS" ] Perform Script [ “Set Zoom” ] // Go to Related Record [ From table: “Combined_Audit_Checklist”; Using layout: “CAC_Page1” (Combined_Audit_Checklist) ] [ Show only related records ] Commit Records/Requests [ No dialog ] Else Go to Related Record [ From table: “Compliance”; Using layout: “Compliance Entry Screen” (Compliance) ] [ Show only related records ] Commit Records/Requests [ No dialog ] End If End If The second bit of script is the pop window. Form Selection Window Freeze Window Allow User Abort [ On ] Set Error Capture [ On ] New Window [ Name: "Form Selection"; Height: 1; Width: 1; Top: 3000; Left: 1 ] Set Zoom Level [ Lock; 100% ] Go to Layout [ “FormSelectionWndw” (Combined_Audit_Checklist) ] Show/Hide Status Area [ Lock; Hide ] Move/Resize Window [ Current Window; Height: 430; Width: 400; Top: 100; Left: 100 ]Form Selection Window Freeze Window Allow User Abort [ On ] Set Error Capture [ On ] New Window [ Name: "Form Selection"; Height: 1; Width: 1; Top: 3000; Left: 1 ] Set Zoom Level [ Lock; 100% ] Go to Layout [ “FormSelectionWndw” (Combined_Audit_Checklist) ] Show/Hide Status Area [ Lock; Hide ] Move/Resize Window [ Current Window; Height: 430; Width: 400; Top: 100; Left: 100 ] Any assistance is appreciated. Regards Michael
Royce Posted January 20, 2010 Posted January 20, 2010 (edited) Morning Michael - Hope you are well. A couple of things... 1. I am assuming that you repeating the script (you duplicated the script there twice) in the "The second bit of script is the pop window" is simply a posting error so I am taking the first half of the second script as the second script. 2. Is the window that comes up reading - "Do you want to VIEW compliance reports for this facility or CREATE a new one?" If so, you are blowing through the Form Selection Window Script (called in Line 5 of your first script - 'Perform Script [ “Form Selection Window” ]') because there is no code to stop the execution of the second script so it simply runs, completes and returns to.... the line after the Perform Script in your First script, which is your Custom Dialog - 'Show Custom Dialog [ Title: "Compliance"; Message: "Do you want to VIEW compliance reports for this facility or CREATE a new one?"; Buttons: “New”, “View” ] ' So your Form Selection Window should be in the background with this Custom Dialog on top.... If you want interaction in the Form Window, you need to pause the Form Window script somewhere before you go to the Custom Dialog script step... Don't know if this is what you're seeing... use your Script Debugger (under TOOLS on the top Menu Bar) to SLOWLY go through the script to see what is happening and you can debug pretty easily. All the best, Royce Edited January 20, 2010 by Guest
mfl Posted January 20, 2010 Author Posted January 20, 2010 (edited) Hi Royce, Thanks for the response. Yes there is only supposed to be one iteration of the window creation, must have hit paste twice. In the main script I was playing around with positioning of the perform window and the show dialog statements. I thought that that might be the issue I was having with the script blowing right through the window and displaying the wrong form(which is something that still needs to be worked out). Not only does it blow right through but it displays the form in the small window, which I think I can fix. Thinking this over alittle more I think I am going to redesign this sequence and merge the dialog options into the window selection. That way the user only has one interruption. For my own knowledge how would I go about stopping the flow in the window. Does it have to do having a mandatory entry or action happen in the window? Regards Michael Edited January 20, 2010 by Guest
Royce Posted January 20, 2010 Posted January 20, 2010 Michael - The reason it is blowing through is because you are calling it from the MIDDLE of another script (code before and code after) so as soon as the second script is done it returns to the first script (automatically) to start executing the first script where it left off when it branched out to your Perform Script subroutine. One solution is to finish the first script before you call a second script (I usually only use calls to other scripts to run simple routines that will finish and return to the main one and therefore not "stack" paused scripts which can be a bear for the user sometimes unless you code very carefully and test, test, test. Other than that, you can always "pause" a script using the "Pause/Resume Script" step (the second script in the script list) to pause while you interact with the screen. Then, you should add another "Pause/Resume Script" step from a button on your window so your user doesn't have to "find" the system button which is located in the top status bar (FM10 - side status bar FM 1-9) - WHICH you may have restricted the user from (which you did a Hide Status in your last script) - so it's best to put the control on your window as well to resume so you make the User experience much better... Kind regards, Royce
Recommended Posts
This topic is 5422 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