childPanel()

Opens a child panel without connection to the Event Manager.

Synopsis

int childPanel(dyn_anytype params [, dyn_anytype &results])

Parameters

Parameter Description
params

Parameters used for the child panel.

These must contain the following elements:

  • ModuleName (string) - Name of the module.
  • FileName (string) - File name of the panel that is opened as relative path to the /panels directory.
  • ParentName (string) - Name of the parent panel.
  • PanelName (string) - Panel name that is shown in the title bar.
  • XPos (Integer) - X Position relative to the parent panel.
  • YPos (Integer) - Y Position relative to the parent panel.
  • Scale (Float)
  • ParentScale (Bool)
  • Parameter (dyn_anytype) - $ parameters that are passed to the child panel.
  • Modal (bool) - Setting that specifies if the child panel should be opened modally.
  • Additional optional parameter (mapping) - additional options that can be passed to the panel. See description below.
results Return value of the panel as dyn_anytype.

Return Value

The function returns 0 if it was successfully executed and in case of errors -1.

Errors

Missing or wrong arguments.

Description

The function childPanel() is a generic option of the other ChildPanel*() functions and allows you to define several parameters manually. The function childPanel() returns optionally return values of the panel via the &results parameter.

Please note that unlike the ChildPanel*() functions this function does not use the internal UI data points and does not establish a connection to the event manager. This implies that a child panel opened by using this function can only be closed using the panelOff() function.

Optional Parameters

The following parameters can be specified for the mapping and can be passed as additional information to the panel:

  • makeVisible (bool) - Defines whether the panel should be visible when opening the panel. The default is TRUE (= visible). If the panel should be opened as invisible, the panel must be set to visible via the panel setting WindowVisible
  • showWithoutActivating (Bool) - with the option "showWithoutActivating" of the function childPanel() the focus change of the panel can be suppressed when opening a child panel. In order to not set the child panel active and that it does not get the focus, set the window flag "WindowDoesNotAcceptFocus" in the init script of the child panel.
Note: WindowFlags need to be set before the window is shown. Changed flags for an already shown window have no effect.
Note: A child panel can not be resized. The only exception to this is the use of Layout Management in the child panel.

EXAMPLE

In the following example the child panel "myPanel.pnl" is opened. By using the mapping "options", the child panel is set to invisible and must be set visible manually.

main()
{
  mapping options = makeMapping("makeVisible", FALSE);
  dyn_anytype da = makeDynAnytype(myModuleName(), "myPanel.pnl", myPanelName(), "My Panel", 50, 50, 1.0, FALSE, makeDynAnytype(), FALSE, options);
  childPanel(da);
}

With the option "showWithoutActivating" of the function childPanel() the focus change of the panel can be suppressed when opening a child panel. In order to not set the child panel active and that it does not get the focus, set the window flag "WindowDoesNotAcceptFocus" in the init script of the child panel.

The script for the "Clicked" event of the text field.

main(mapping event)
{
  dyn_anytype da = makeDynAnytype(myModuleName(), "child_panel", myPanelName(), "child", 100, 120, 1.0, true, makeDynString(), false, makeMapping("showWithoutActivating", true));
  childPanel(da);
}

The script for the "Initialize" event of the child panel.

main()
{
  string flags = self.windowFlags;
  self.windowFlags = "WindowDoesNotAcceptFocus";
  Debug(self.windowFlags);
}

Assignment

Panel functions

Availability

UI