panelPosition()

Returns the position of a panel.

Synopsis

int panelPosition(string modulName, string panelName, int &xPos, int &yPos);

Parameters

Parameter Description
modulName Module in which the panel is located
panelName Panel name
xPos, yPos Position of the panel

Return value

Position of the panel

Error

Description

The function panelPosition() returns the relative position (xPos, yPos) of the current panel to the panel panelName. If an empty string is transferred as the panelName, panelPosition() returns the absolute screen coordinates of the current panel.

The moduleName parameter is only used if a panel name is also stated.

Please be aware that the return values of panelPosition might differ between the initialize script call and the actual position after loading all panels when used within a grid layout.

Example

The following example outputs the absolute position of the panel.

main()
{
   int x, y;
   panelPosition(""(),"",x,y);
   DebugN("X",x,"Y",y);
}

Example

The following example returns the difference in coordinates between the current Panel and the child panel "myOtherPanel". The LogViewer will print the values x:-100;y:-100 as the child panel is opened with this offset.

main()
{
  int x, y;
  dyn_float resultFloat;
  dyn_string restultString;
  ChildPanelOn("about.pnl", "myOtherPanel", makeDynString(),100,100);
  while(!isPanelOpen("myOtherPanel")){}; //Wait until panel is opened
  panelPosition(myModuleName(),"myOtherPanel",x,y);
  DebugN("X",x,"Y",y);
}

Assignment

Graphics

Availability

UI