WIDGET_POSITIONER - ITA-Solar/solo-spice-ql GitHub Wiki

Source code: widget_positioner__define.pro

Class: PRITS_TOOLS

Table of contents generated with markdown-toc

Purpose

This object can be used to position a new widget relative to another widget, or relative to the screen. This also works with multiple screens. The widget is positioned and realised by this object.

Note, this is similar to the xrealize procedure, but more sophisticated.

Calling sequence

parent = widget_base(/column, title='Parent Widget', xsize=300, ysize=400)
widget_control, parent, /realize

new_window = widget_base(/row, title='New Widget', xsize=400, ysize=300, group_leader=parent)

wp = widget_positioner(new_window, parent=parent)
wp->position, xoffset=xoffset, yoffset=yoffset

INIT

The INIT function initialises the WIDGET_POSITIONER object.

wp_object = WIDGET_POSITIONER( WIDGET [, PARENT=PARENT] )

INPUTS

WIDGET

The ID of the widget to be positioned. Can also be set later with method 'SET_WIDGET'.

PARENT

The ID of the parent widget to which the widget should get a certain position. Optional, but if provided then the parent widget must be realised already. If not provided the widget will be positioned relative to upper left corner of display. Can also be set later with method 'SET_PARENT'.

OUTPUT

1 (True) if initialization succeeded, 0 (False) otherwise.

HELP

This routine prints out information about the class, such as name, location of definition file and version if there is a line in the header comment beginning with '$ID: ' (comes from CVS). Then it prints out each procedure and function that has a comment line right after the definition.

wp_object->HELP [, /DESCRIPTION]

KEYWORD

DESCRIPTION

If set, the header info of the class will also be printed.

POSITION

This procedure calculates where the new widget should be placed and checks, whether the whole widget is within the display. If this is not the case it alters the new position, so that it is fully, if possible, within the display. It also sets the new offset to the widget and realises the widget then.

wp_object->POSITION [, XOFFSET=XOFFSET] [, YOFFSET=YOFFSET] [, N_SUBPLOT=N_SUBPLOT] [, /LEFT_ALIGN] [, /RIGHT_ALIGN] [, /TOP_ALIGN] [, /BOTTOM_ALIGN] [, /CENTER]

INPUTS:

XOFFSET

Optional. The offset in x-direction relativ to the parent widget or the display. Default=50 pixels. Overwritten if left_align or right_align is set.

YOFFSET

Optional. The offset in y-direction relativ to the parent widget or the display. Default=50 pixels. Overwritten if top_align or bottom_align is set.

N_SUBPLOT

Optional. Number of widgets already shifted. Each widget is positioned in a slightly different position.

KEYWORDS:

LEFT_ALIGN

If set, the widget will be positioned to the left of the parent, if there is enough space.

RIGHT_ALIGN

If set, the widget will be positioned to the left of the parent, if there is enough space. Ignored if left_align is set.

TOP_ALIGN

If set, the widget will be positioned to the left of the parent, if there is enough space.

BOTTOM_ALIGN

If set, the widget will be positioned to the left of the parent, if there is enough space. Ignored if top_align is set.

CENTER

If set, the widget will be positioned in the center of the parent, or of the screen if no parent is provided.

SET_WIDGET

Sets a new widget that can be positioned.

wp_object->SET_WIDGET, WIDGET

INPUT:

WIDGET

The widget ID of the widget to be set.

GET_WIDGET

Sets a new widget that can be positioned.

widget_id = wp_object->GET_WIDGET()

OUTPUT:

Returns the widget that can be positioned.

SET_PARENT

Sets a new parent widget to which the widget should be relatively positioned. Set to a negative value to remove parent.

wp_object->SET_PARENT, PARENT

INPUT:

PARENT

The widget ID of the new parent widget.

GET_PARENT

Gets the parent widget to which the widget should be relatively positioned.

parent_id = wp_object->GET_PARENT()

OUTPUT:

Returns the widget ID of the parent widget.

⚠️ **GitHub.com Fallback** ⚠️