![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
hi all, i'm trying to use the button featre where it opens a related record in a new window from an existing portal. So right now the feature works, where i have checked off the appropriate table and layout and checked off "show in new window". But the problem is that in the protal if i use he button, each time it opens a new window. I dont want multiple windows to open, just one NEW window to open and then that one being used to show the records. I have other places to use the patternmatch funtion with the window name but i need more specifics. Basically i want the following to happen: IF (windowA is already open) THEN (open related record in windowA) ELSE (open new window named windowA with related record) thanks for help. |
#3
| |||
| |||
|
|
hi all, i'm trying to use the button featre where it opens a related record in a new window from an existing portal. So right now the feature works, where i have checked off the appropriate table and layout and checked off "show in new window". But the problem is that in the protal if i use he button, each time it opens a new window. I dont want multiple windows to open, just one NEW window to open and then that one being used to show the records. I have other places to use the patternmatch funtion with the window name but i need more specifics. Basically i want the following to happen: IF (windowA is already open) THEN (open related record in windowA) ELSE (open new window named windowA with related record) thanks for help. |
#4
| |||
| |||
|
|
You need to test to see if an instance of the window is already open, if not, open one. Try a variation of the following script. Select Window [ Name: "windowA" ] If [ Get ( LastError ) â‰* 0 ] New Window [ Name: "windowA"; Height: 318; Width: 406; Top: ((Get ( WindowDesktopHeight ) - Get ( WindowHeight )) / 2) - 50; Left: (Get ( WindowDesktopWidth ) - Get ( WindowWidth )) / 2 ] Go to Layout [ "anyLayout" ] Show/Hide Status Area [ Lock; Hide ] End If Michael Myett |
#5
| |||
| |||
|
|
Michael Myett wrote: You need to test to see if an instance of the window is already open, if not, open one. Try a variation of the following script. Select Window [ Name: "windowA" ] If [ Get ( LastError ) ? 0 ] New Window [ Name: "windowA"; Height: 318; Width: 406; Top: ((Get ( WindowDesktopHeight ) - Get ( WindowHeight )) / 2) - 50; Left: (Get ( WindowDesktopWidth ) - Get ( WindowWidth )) / 2 ] Go to Layout [ "anyLayout" ] Show/Hide Status Area [ Lock; Hide ] End If Michael Myett Michael: I saw this as an improvement on what I had come up with and sought to implement it. As a test, I scripted Select window [ Name: "WindowA" ] If [ Get ( LastError ) ? 0 ] Show custom dialog [ Get (LastError) ] End If The Custom Dialog displays "0". No, wait. It was supposed to be if it DIDN'T equal zero. So why did it trap? So I tried Select window [ Name: "WindowA" ] Show custom dialog [ Get (LastError) ] and the Custom Dialog displayed "112" (Window is Missing) Then I tried Select window [ Name: "WindowA" ] If [ Get ( LastError ) = 112 ] Show custom dialog [ Get (LastError) ] End If The Custom Dialog is displayed, but it still shows "0". Obviously, the technique does work either way (and I certainly won't include the Custom Dialog in the finished product) but I am curious as to why, if the error is 112, does it show up as a "0" in the custom dialog? Matt |
#6
| |||
| |||
|
|
Michael Myett wrote: You need to test to see if an instance of the window is already open, if not, open one. Try a variation of the following script. Select Window [ Name: "windowA" ] If [ Get ( LastError ) â‰* 0 ] New Window [ Name: "windowA"; Height: 318; Width: 406; Top: ((Get ( WindowDesktopHeight ) - Get ( WindowHeight )) / 2) - 50; Left: (Get ( WindowDesktopWidth ) - Get ( WindowWidth )) / 2 ] Go to Layout [ "anyLayout" ] Show/Hide Status Area [ Lock; Hide ] End If Michael Myett Michael: I saw this as an improvement on what I had come up with and sought to implement it. As a test, I scripted Select window [ Name: "WindowA" ] If [ Get ( LastError ) â‰* 0 ] Show custom dialog [ Get (LastError) ] End If The Custom Dialog displays "0". No, wait. It was supposed to be if it DIDN'T equal zero. So why did it trap? So I tried Select window [ Name: "WindowA" ] Show custom dialog [ Get (LastError) ] and the Custom Dialog displayed "112" (Window is Missing) Then I tried Select window [ Name: "WindowA" ] If [ Get ( LastError ) = 112 ] Show custom dialog [ Get (LastError) ] End If The Custom Dialog is displayed, but it still shows "0". Obviously, the technique does work either way (and I certainly won't include the Custom Dialog in the finished product) but I am curious as to why, if the error is 112, does it show up as a "0" in the custom dialog? Matt |
#7
| |||
| |||
|
#8
| |||
| |||
|
|
Perhaps the "If [ Get ( LastError ) = 112 ]" script step sets the error number to zero? I'm not really sure. So I tried the following script. First create a global number field, gError, to trap the last error number. Select Window [ Name: "windowA" ] Set Field [ anyTable::gError; Get ( LastError ) ] If [ The Deal::gError â‰* 0 ] Show Custom Dialog [ Title: "Error ..."; Message: The Deal::gError; Buttons: "OK" ] New Window [ Name: "windowA"; Height: 193; Width: 148; Top: 205; Left: 205 ] Go to Layout [ "anyTable" (anyLayout) ] Show/Hide Status Area [ Hide ] Set Field [ anyTable::gOrigin; Get ( ScriptParameter ) ] End If This seems to behave as expected. Michael Myett |
#9
| |||
| |||
|
|
thanks guys, the script works like i wanted. but i have another problem. since i am using the script inside a portal, after i click the button the window always shows the first record from the portal. I think once the script is initiated and the Select Window function runs, FMP7 loses track of which row of the related record to use, and so it goes to the first related record, instead of the related record of that row. Any ideas? thanks again |
#10
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |