ChildPanelOnReturn()
Opens a child panel with return values.
Synopsis
ChildPanelOnReturn(string FileName, string PanelName,dyn_string Parameter,int x, int y,dyn_float &resultFloat, dyn_string &resultText, time
timeout=86400);
Parameters
Parameter | Meaning |
---|---|
FileName | File name of the child panel to be opened |
PanelName | Name under which the child panel is to be displayed |
Parameters | Parameters for transfer to the child panel |
x, y | Position of the child panel |
resultFloat | Return field for floats |
resultText | Return field for strings |
timeout | Optional timeout for the panel, default 1 day. 0 = no timeout. If the user does not close the panel, the function returns the value anyway after the specified timeout. |
Return Value
None
Description
The function ChildPanelOnReturn() opens a child panel at the position x, y, parallel to ChildPanelOn(). Before the panel is opened a check is made as to whether this panel is already open (isPanelOpen()). The size ratio between child and parent panel is 1 (scale = 1). If the size of the parent panel is changed, the child panel is not scaled to the new size.
The special thing about it that return values can be transferred to the fields resultFloat and resultText. These values must be transferred from the child panel to two predefined data points. The values are passed automatically via the standard dialog panel. The values can be set using a dpSet(). The names of the reserved data points are:
-
"_Ui_<i>.ReturnValue.Float:_original.._value"
-
"_Ui_<i>.ReturnValue.Float:_original.._value"
where the number of the current manager is to be used for i, for example,
"_Ui_2.ReturnValue.Text:_original.._value"
After the child panel is closed the values are automatically transferred from the data points to the fields resultFloat and resultText.
A child panel can not be resized. The only exception to this is the use of Layout Management in the child panel.
Example
The child panel "ChildPanel" is opened via the parent panel. The function also passes dollar parameters to the child panel.
main()
{
dyn_float dreturnf;
// Variables for the return values
dyn_string dreturns;
string strvar = "example";
int x, y;
x = 300;
y = 100;
ChildPanelOnReturn("ChildPanel.pnl",
"Testpanel", makeDynString("$p1:first","$p2:"+strvar), x, y,
dreturnf, dreturns); // The code below is executed first when the child panel is closed
DebugN(dreturnf);
// show the return values
DebugN(dreturns);
}
Example
The return values are set in the child panel "ChildPanel.pnl". When the panel is closed they are passed to the parent panel. Since you passed dollar parameters, you can call , for example,
DebugN($p1); and
DebugN($p2); in the child panel.
The first definition DebugN($p1); returns the string "def"; and the second definition the string "example".
main()
{
dyn_float df;
//Return fields
dyn_string ds;
//Return values
df[1] = 123;
df[2] = 23.123;
df[1] = "Test";
df[2] = "value";
//Setting the values
dpSet("_Ui_"+myManNum()+".ReturnValue.Float:_original.._value",df);
//Setting the float value
dpSet("_Ui_"+myManNum()+".ReturnValue.Text:_original.._value",ds);
//Setting the string value
DebugN($p1);
DebugN($p2);
}
The panel MessageInfo1 opens with a message:
main()
{
dyn_float df;
dyn_string ds;
ChildPanelOnReturn("MessageInfo1",
"Information", makeDynString("$1:This is a text!"), 300, 200, df, ds);
}
Assignment
panel.ctl