Properties and events of the panel

Property sheet

The property sheet of a panel opens when a panel is opened. In the property sheet, you can edit the panel properties.

The following figure shows the Standard tab of a panel.

Figure 1. Property sheet of a panel

The following table lists and describes the properties of panels.

Entry in the Property Sheet Description
Name The Panel name is a unique name identifying the panel and is shown in the window header after it has been saved. You must assign panel names if you want to address panels in scripts.
Typename

The Typename, as well as the panel name, can be used for a more detailed definition of selectors in stylesheets. Moreover, it is possible to set/get the type name during runtime by using setValue/getValue (e.g. setValue(myModuleName() + "." + myPanelName() + ":", "type", "paneltype1" );).

Note

If the type attribute is changed during runtime the stylesheet property must be reapplied (see setApplicationProperty()).

Only ASCII characters are allowed for defining the type name.

RefPoin tX, RefPoint Y The position of the panel is specified by the coordinates. This is important when a panel will be used as a reference by another panel (see chapter Properties of references and override).
Size X, Y

The height and width of a panel (Pixel) (available via CTRL) - size(width, height)

Note

Although, with Qt5 the maximum possible size of a panel is QSize(16777215,16777215) pixels, but it is recommended not to exceed the size 32,000 x 32,000 pixels, because only then every pixel is displayed correctly. However, it is also discouraged from creating panels with this size, if a not high-performance graphics card is used. Under Windows, it can lead also to a too high GDI resource consumption. Thus, it is recommended to create more small panels than one big one.

Layout Bottom/Left/ Right/Top Margin Defines the space between the layout and the panel borders.
Layout Spacing Defines the space between the layouts.
Layout Type

Enables the layout management and defines the layout type. There are two different types:

  • HBox
  • VBox
  • Grid

For further details refer to the chapter Layout management.

Active layer

Shows the visible layers.

Clicking on this field opens the Layers Sheet (see also The Layer window (Layer settings) ).

Keep in memory

The panel remains in cache.

With the Keep in memory property you can choose whether the panel should be held in cache. Since it is stored there by default, you can reduce memory usage by selecting No. (available via CTRL) - keepInMemory(bool)

Note

If you use references and change these in a panel with the default setting "Cache Panel", you have to restart the UI to actualize the chances.

LangChange redraw only

Defines the handling of the panel when you switch the language.

TRUE: The switching will be executed by "redrawing" all static panel texts and by executing the "LangChanged". Use this option with new panels that have no "Initialize" scripts for setting a specific text to defined objects.

FALSE: The "Redraw only" option. Additionally, all childpanels will be closed, all CTRL scripts stopped (also the script with the switchLang() function) and all "Initialize" executed. This option is activated by default and should be used with older panels that transfer texts to objects at the initialization.

layoutEnabled Gets or sets if the panel has the layout handling enabled or disabled (available via CTRL) - layoutEnabled(bool)
Maximum Size Gets or sets the maximum size of the panel (available via CTRL) - maximumSize(width, height)
mapFromGlobal Allows to convert the global coordinates into panel relative coordinates. Panel coordinates are based on the upper left corner (0,0) of the panel and do not take into account if the panel is zoomed or original size. (available via CTRL) - mapFromGlobal(int gx, int gy, int &x, int &y);
mapToGlobal Allows to convert the panel relative coordinates into global coordinates. Panel coordinates are based on the upper left corner (0,0) of the panel and do not take into account if the panel is zoomed or original size. (available via CTRL) - mapToGlobal(int x, int y, int &gx, int &gy);
Minimum Size Gets or sets the minimum size of the panel (available via CTRL) - minimumSize(width, height)
moduleName Gets the name of the current module (like myModuleName()) (read-only; available via CTRL) - moduleName(string)
namePath

Returns the path to the panel reference based of the location of the top parent panel. (read-only; available via CTRL) - namePath()

Only available for panel references.

panel

Gets a pointer to the stated panel (read-only; available via CTRL) - panel(string panelName, shape &panel)

Not available for panel references.

Panel Background

The background color and/or image of a panel.

You can design the panel to have a color background (the color selector is opened) and/or an image. All newly selected background images are always shared (located in ../pictures directory or the subdirectory).

Note

  • The scaling of background images may differ between buttons and other graphic objects.
  • Setting the panel background of a child panel to transparent can only be used if the "FramelessWindowHint" is set via CTRL script for the "windowFlags" property.
  • If no explicit background color is selected the default background color of a panel is used. This also applies if a background image is defined.
  • The background of a non-child panel cannot be set transparent.
Panel File Name Relative path to the panel inside of the file system. (available via CTRL) - panelFileName(string)
parentPanel Gets a pointer to the parent panel of the current panel when inside an embedded module, else an invalid 0-pointer is returned (read-only; available via CTRL) - parentPanel(shape)
parentShape Gets the pointer to the embedded module shape if the current panel is inside an embedded module, else 0 is returned. (read-only; available via CTRL) - parentShape(shape)
Reference file Instead of using the default configuration panel for setting $ parameters when inserting references, you can use your own panel. A panel is linked as a configuration panel by entering the panel name next to the property "Reference file" in the Property Sheet of the reference panel, for example, "para/ refpanel.pnl" or version panels: objects_parampanels/STD_ACTIVEX/CircularAnalog_para.pnl.
rootPanel Gets a pointer to the root panel of the current panel. If no root panel is available the current panel is returned. (read-only; available via CTRL) - rootPanel(shape)
Runtime selection Panel attribute "Runtime Selection" to turn on (default = off). The option to activate the selection of primitive shapes in a vision module. For more information see Multiselection at run time.
Send Mouseclick

If the Send click property has been set to Yes, then the x and y position of a mouse-click in the panel will be sent to data point elements of the UI manager being used. In addition to the X and Y coordinates, also the associated module and panel are saved in the data point. Thus, for example, the coordinates of the last mouse click can be queried.

Default: No.

Start Init-Script in Ref

Starting the script EventInitialize.

Starts the Initialize and the Terminate script, if the panel is used as reference. the default is Yes.

startInitScriptMode

Start mode of scripts

The startInitScriptMode attribute affects all shapes of the own panel. If you use references in your panel, the start behavior of the shapes within a reference is affected by its own startInitScriptMode attribute.

All Objects: (default): the panel starts all "Initialize" scripts when you open it. Whether the object is located within the display or on a visible layer is not considered.

Visible Objects:

When you open a panel, the panel only executes the scripts of objects located within the display and on a visible layer.

The further panel area with its objects is built first at runtime via scrolling to left/right/up/down. The area is built having regard to the cluttering settings for the different layers.

The panel executes the "Initialize" scripts configured for different objects first when the object is located within the display and on a visible layer.

See also chapter: Cluttering/Decluttering.

Within the references the system also executes scripts of shapes that are invisible.

If you set the startInitScriptMode of a reference to AllObjects and the startInitScriptMode of the main panel to Visible Objects, the system executes the scripts of all visible references. Within the references, however, the system also executes the scripts of objects that are invisible.

The following table illustrates the behavior:

Panel Reference Start
Visible Objects Visible Objects Executes the scripts of shapes, which are at least partly visible.
All Objects Visible Objects Executes the scripts of shapes, which are at least partly visible.
Visible Objects All Objects Executes all scripts of shapes, if the total reference is visible.
All Objects All Objects Executes all scripts of shapes independent of the visibility.
initAllShapes The write-only attribute allows to trigger all shape initialization scripts (if not yet started) even if the shapes are currently not visible and the startInitScriptMode has been set to "only visible shapes". (available via CTRL) - initAllShapes()
Start Zoomfactor Zoom factor that will be used when a panel is opened.
ZoomPoint X, Y

x position of a panel when the panel is opened.

y position of a panel when the panel is opened.

updatesEnabled Allows to deactivate the graphical updates of the panel to get a smooth drawing experience for the panel content. (Available via CTRL) - self.updatesEnabled(bool)
windowFlags

Gets or sets specific flags that define the behavior of the panel. Multiple flags can be set by using the pipe symbole ("|") (Available via CTRL) - windowFlags(string)

Following flags are available:

  • "FramelessWindowHint" ... Produces a borderless window. The user cannot move or resize a borderless window via the window system. On X11, the result of the flag is dependent on the window manager and its ability to understand Motif and/or NETWM hints. Most existing modern window managers can handle this.
  • "NoDropShadowWindowHint" ... Disables window drop shadow on supporting platforms.
  • "CustomizeWindowHint" ... The CustomizeWindowHint flag is used to enable customization of the window controls. This flag must be set to allow the WindowTitleHint, WindowSystemMenuHint,WindowMinimizeButtonHint, WindowMaximizeButtonHint and WindowCloseButtonHint flags to be changed.
  • "WindowTitleHint" ... Gives the window a title bar.
  • "WindowSystemMenuHint" ... Adds a window system menu, and possibly a close button (for example on Mac). If you need to hide or show a close button, it is more portable to use WindowCloseButtonHint.
  • "WindowMinimizeButtonHint" ... Adds a minimize button. On some platforms this implies Qt::WindowSystemMenuHint for it to work.
  • "WindowMaximizeButtonHint" ... Adds a maximize button. On some platforms this implies Qt::WindowSystemMenuHint for it to work.
  • "WindowCloseButtonHint" ... Adds a close button. On some platforms this implies Qt::WindowSystemMenuHint for it to work.
  • "WindowShadeButtonHint" ... Adds a shade button in place of the minimize button if the underlying window manager supports it.
  • "WindowStaysOnTopHint" ... Informs the window system that the window should stay on top of all other windows.
  • "WindowStaysOnBottomHint" ... Informs the window system that the window should stay on bottom of all other windows.
  • "WindowTransparentForInput" ... Informs the window system that this window is used only for output (displaying something) and does not take input. Therefore input events should pass through as if it wasn't there.
  • "WindowDoesNotAcceptFocus" ... Informs the window system that this window should not receive the input focus.
windowFrameGeometry

This property holds the geometry of the window including the window frame. Can be used to move or resize the panel during run-time (available via CTRL) - windowFrameGeometry(x, y, w, h).

Note

  • Can also be changed via animate() function. In this case the four values have to be stated as dyn_int element.
  • Cannot be used if the panel is located in an embedded module.
  • For a child panel the coordinates are relative to the parent panel.
  • If the geometry is queried before the panel is visible the returned values are not correct as these values are asynchronously set by the window manager after the window is positioned, etc.
windowGeometry

This property holds the geometry of the window excluding the window frame. Can be used to move or resize the panel during run-time (available via CTRL) - windowGeometry(x, y, w, h).

Note

  • Can also be changed via animate() function. In this case the four values have to be stated as dyn_int element.
  • Cannot be used if the panel is located in an embedded module.
  • For a child panel the coordinates are relative to the parent panel.
  • If the geometry is queried before the panel is visible the returned values are not correct as these values are asynchronously set by the window manager after the window is positioned, etc.
Window Icon

Defines an icon which is displayed on the left side of a panel's title bar at runtime. You have to type in the icon name, e.g. myIcon.jpg.

The icon must be located in the /pictures directory. In case that a empty string is given, the default icon is shown.

windowOpacity

This property allows to define the opacity of the complete top level window (module or child panel). The valid range for the property is between 0.0 (completely transparent) and 1.0 (completely opaque). The default value is 1.0. (available via CTRL) - windowOpacity(float)

Note

  • This property is not available when the panel is used inside an embedded module
  • Semi-transparent window updates and size changes are significantly slower than updates or changes to opaque windows
windowState

This property can be used to set the window state (available via CTRL) - windowState(string)

Following states can be set:

  • WindowNoState (default - Normal state)
  • WindowMinimized
  • WindowMaximized
  • WindowFullScreen
  • WindowActive

Note

  • Multiple states can be combined using "|", e.g. "WindowMaximized|WindowActive"
  • The change of the state for invisible panels is only applied as they are set visible. For visible panels the changes are performed immediately.
  • For some window managers it may occur that the WindowActive state is not applied immediately or even ignored.
windowVisible

The attribute allows to get or set the visibility of the panel. (available via CTRL) - windowVisible(bool)

Note

This property is not available when the panel is used inside an embedded module

writeToFile

The attribute allows to save a panel via script. (Available via CTRL) - writeToFile(string fileName, string format)

Notes

The "fileName" parameter corresponds to the name of the panel including the relative path in which the panel should be saved. The relative path is based on the project folder proj_path/panels/.

The "format" parameter defines which panel format should be used to save the panel. The values "PNL", "XML" or an emtpy string can be used. Using an empty string indicates that the default panel format of the project is used, see defaultPanelFormat.

It is to consider that properties of objects are not stored within the panel if "writeToFile" is used. They must be set using corresponding public functions within the "initialize" script of the object.

Restore Module Size

If enabled (=TRUE) the size of the module is not adapted to fit the panel but instead the size values of the PVSS00ui.ini file are used (if available).

The property must be set in the panel to which the module is added (e.g. by using moduleAddDockModule()).

If a panel with a transparent background image is opened in several subsequent VISION modules, the background image might be displayed black or not at all.

If you use references and change these in a panel with the default setting "Cache", you have to restart the UI to update the changes.

scriptable Properties

These Attributes can be used in a Script to adress a Panel.

Property Description
selection

List of all shapes and groups selected in the panel.

read & write access

shapes

Returns all list pf pointers to all shapes within a panel, with the exeption of Panel-References

read only

groups

Returns a list of pointers to all groups and toplevel Panel-References

read only

Events

The following events are available for panels:

Events Action
Initialize When a panel is opened.
Clicked

Left-click or other available buttons.

The exception is the right click, which has its own event.

The button being used is specified in the mapping "event", which is passed to the script.

Note: To use the middle mouse button to activate scripts, panning must be deactivated with [ui] middleMousePanning.

Close When clicking close in the title bar "x" or using the close panel option of the panel menu, you can configure a CTRL script to save your data. The script will be executed, but neither the panel nor the module are closed. To close the panel, you have to execute a PanelOff("PanelName") in the "Close" script. EventClose should prevent an accidental close of the module, and therefore could open a child panel with an "are you sure" dialog e.g.
DoubleClicked Left-double-click
DragDrop This event will be started when the user drops the information onto a panel and the panel notified the system before to accept the dropped media with dropAccept(). The passed arguments are the same as in the DragEnter event. See below.
DragEnter

This event will only be started when the panel accepts drops and has not been disabled. The panel must decide if it is prepared to accept the dropped information. If it is prepared, it must call the new CTRL function:

int dropAccept( bool accept = true)

For more information see Drag & Drop at runtime.

GestureTriggered

This event is triggered via a swipe gesture e (a move with 1 or 2 fingers). The swipe gesture only works when the panel in the module is not larger than the viewport so that no scrollbars are needed (you see the complete panel). Otherwise a swiping move does panning (but this does not trigger the gesture script.

This event is also available for the embedded module. If you use the event for both - the panel and the embedded module in a panel, the gesture of the embedded module is triggered when you swipe the embedded module. When you swipe the panel (outside the embedded module), the gesture of the panel is triggered. If the embedded module also contains a panel and the event "GestureTriggered", both the event of the embedded module and of the panel that is loaded in the module, are triggered.

The script has the following arguments:

main(string type, mapping data)

type = "swipe"

The mapping data has the following key/value pairs:

  • "angle"/float ... the direction of the finger movement
  • "horizontal"/string ... one of "right", "left", "none"
  • "vertical"/string ... one of "up", "down", "none"
  • "touchpoints"/int ... either 1 (swipe gesture with 1 finger) or 2 (swipe gesture with 2 fingers)
  • "startPos"/dyn_int ... x,y coordinates of the start point in panel coordinates (unzoomed)
  • "endPos"/dyn_int ... x,y coordinates of the end point in panel coordinates (unzoomed)

The values for "horizontal" and "vertical" are calculated out of the angle internally, if you, for example, move to the right but slightly up, the value of the horizontal will be "right" but the value of the up will still be "none")

type = "scrollToPanel"

The mapping data has the following key/value pairs:

  • "targetPos" ... integer value of the position that has been scrolled, similar to the function "scrollToPanel".

LangChanged If the language is changed at runtime
RightMousePressed Right-click
ScopeLib

In this script of the attribute-editor, you declare functions and (script-global) variables that are used by all objects of the panel (except panel references). The panel global variables exists only once and can be changed by all scripts.

Note

Inside the GEDI the initialization of the ScopeLib is only performed if at leas one #property has been defined.

Terminate

When terminating with panelOff() or a close button, the panel closes immediately. It is only possible to execute a last dpSet(), for example, to free a lock.

The call of the function LogoutDialog() triggers the "Terminate" Event.

Zoom

When zooming, "Zoom" is not possible for default panels of the version. If no script has been defined, the function Panel_OnZoomed from libs/panel.ctl will be executed (only if a panel name exists).

Syntax: main (string moduleName, string panelName).

If a reference exists twice, there will also be two variables.