Class Dialog

See also

See Dialog Examples on Live LibreOffice Python UNO Examples for more information on how to use this class.

class ooodev.dialog.Dialog(title, x=-1, y=-1, width=-1, height=-1, *, lo_inst=None, dialog=None)[source]

Bases: CtlDialog, DialogControlsPartial, DialogsPartial

Class for creating a Dialog. Multiple Document are supported

Parameters:
  • args (Any) –

  • kwargs (Any) –

Return type:

Any

__init__(title, x=-1, y=-1, width=-1, height=-1, *, lo_inst=None, dialog=None)[source]

Dialog Constructor

Parameters:
  • title (str) – Dialog title.

  • x (int, UnitT) – The x-coordinate of the window. In 1/100 mm or UnitT. If -1, the dialog Position is not set. Default is -1.

  • y (int, UnitT) – The y-coordinate of the window. In 1/100 mm or UnitT. If -1, the dialog Position is not set. Default is -1.

  • width (int, UnitT) – The width of the window. In 1/100 mm or UnitT. If -1, the dialog Size is not set. Default is -1.

  • height (int, UnitT) – The height of the window. In 1/100 mm or UnitT. If -1, the dialog Size is not set. Default is -1.

  • lo_inst (LoInst, optional) – Lo Instance. Used when creating multiple documents. Defaults to None.

  • ctl (UnoControlDialog) – Dialog Control. If None then an new Dialog is created. Defaults to None.

  • dialog (UnoControlDialog | None) –

Return type:

None

add_event_focus_events_disposing(cb)

Adds a listener for an event.

Event is invoked when the broadcaster is about to be disposed.

The callback EventArgs.event_data will contain a UNO com.sun.star.lang.EventObject struct.

Return type:

None

Parameters:

cb (Any) –

add_event_focus_gained(cb)

Adds a listener for an event.

Event is invoked when a window gains the keyboard focus.

The callback EventArgs.event_data will contain a UNO com.sun.star.awt.FocusEvent struct.

Return type:

None

Parameters:

cb (Any) –

add_event_focus_lost(cb)

Adds a listener for an event.

Event is invoked when a window loses the keyboard focus.

The callback EventArgs.event_data will contain a UNO com.sun.star.awt.FocusEvent struct.

Return type:

None

Parameters:

cb (Any) –

add_event_key_events_disposing(cb)

Adds a listener for an event.

Event is invoked when the broadcaster is about to be disposed.

The callback EventArgs.event_data will contain a UNO com.sun.star.lang.EventObject struct.

Return type:

None

Parameters:

cb (Any) –

add_event_key_pressed(cb)

Adds a listener for an event.

Event is invoked when a key has been pressed.

The callback EventArgs.event_data will contain a UNO com.sun.star.awt.KeyEvent struct.

Return type:

None

Parameters:

cb (Any) –

add_event_key_released(cb)

Adds a listener for an event.

Event is invoked when a key has been released.

The callback EventArgs.event_data will contain a UNO com.sun.star.awt.KeyEvent struct.

Return type:

None

Parameters:

cb (Any) –

add_event_listener(listener)

Adds an event listener to the component.

Parameters:

listener (XEventListener) – The event listener to be added.

Return type:

None

add_event_mouse_dragged(cb)

Adds a listener for an event.

Event is invoked when a mouse button is pressed on a window and then dragged.

The callback EventArgs.event_data will contain a UNO com.sun.star.awt.MouseEvent struct.

Return type:

None

Parameters:

cb (Any) –

add_event_mouse_entered(cb)

Adds a listener for an event.

Event is invoked when the mouse enters a window.

The callback EventArgs.event_data will contain a UNO com.sun.star.awt.MouseEvent struct.

Return type:

None

Parameters:

cb (Any) –

add_event_mouse_events_disposing(cb)

Adds a listener for an event.

Event is invoked when the broadcaster is about to be disposed.

The callback EventArgs.event_data will contain a UNO com.sun.star.lang.EventObject struct.

Return type:

None

Parameters:

cb (Any) –

add_event_mouse_exited(cb)

Adds a listener for an event.

Event is invoked when the mouse exits a window.

The callback EventArgs.event_data will contain a UNO com.sun.star.awt.MouseEvent struct.

Return type:

None

Parameters:

cb (Any) –

add_event_mouse_motion_events_disposing(cb)

Adds a listener for an event.

Event is invoked when the broadcaster is about to be disposed.

The callback EventArgs.event_data will contain a UNO com.sun.star.lang.EventObject struct.

Return type:

None

Parameters:

cb (Any) –

add_event_mouse_moved(cb)

Adds a listener for an event.

Event Is invoked when the mouse pointer has been moved on a window (with no buttons down).

The callback EventArgs.event_data will contain a UNO com.sun.star.awt.MouseEvent struct.

Return type:

None

Parameters:

cb (Any) –

add_event_mouse_pressed(cb)

Adds a listener for an event.

Event is invoked when a mouse button has been pressed on a window.

The callback EventArgs.event_data will contain a UNO com.sun.star.awt.MouseEvent struct.

Return type:

None

Parameters:

cb (Any) –

add_event_mouse_released(cb)

Adds a listener for an event.

Event is invoked when a mouse button has been released on a window.

The callback EventArgs.event_data will contain a UNO com.sun.star.awt.MouseEvent struct.

Return type:

None

Parameters:

cb (Any) –

add_event_observers(*args)

Adds observers that gets their trigger method called when this class trigger method is called.

Parameters:

args (EventObserver) – One or more observers to add.

Return type:

None

Note

Observers are removed automatically when they are out of scope.

add_event_paint_events_disposing(cb)

Adds a listener for an event.

Event is invoked when the broadcaster is about to be disposed.

The callback EventArgs.event_data will contain a UNO com.sun.star.lang.EventObject struct.

Return type:

None

Parameters:

cb (Any) –

add_event_properties_change(names, cb)

Add properties to listen for changes.

Parameters:
  • names (Iterable[str]) – One or more property names to listen for changes.

  • cb (EventArgsCallbackT) – Callback that is invoked when an event is triggered.

Raises:

ValueError – If names is empty.

Return type:

None

Note

The callback EventArgs.event_data will contain a tuple of com.sun.star.beans.PropertyChangeEvent objects.

Each time this method is called, the previous names are removed and the new names are added.

add_event_property_change(name, cb)

Adds a listener for an event.

Event is invoked when property is changed.

The callback EventArgs.event_data will contain a com.sun.star.beans.PropertyChangeEvent struct.

Parameters:
  • name (str) – Property Name

  • cb (EventArgsCallbackT) – Callback

Return type:

None

add_event_property_change_events_disposing(name, cb)

Adds a listener for an event.

Event is invoked when the property listener is about to be disposed.

The callback EventArgs.event_data will contain a UNO com.sun.star.lang.EventObject struct.

Parameters:
  • name (str) – Property Name

  • cb (EventArgsCallbackT) – Callback

Return type:

None

add_event_top_window_events_disposing(cb)

Adds a listener for an event.

Event is invoked when the broadcaster is about to be disposed.

The callback EventArgs.event_data will contain a UNO com.sun.star.lang.EventObject struct.

Return type:

None

Parameters:

cb (Any) –

add_event_vetoable_change(name, cb)

Adds a listener for an event.

Event is invoked when property is changed.

The callback EventArgs.event_data will contain a com.sun.star.beans.PropertyChangeEvent struct.

Parameters:
  • name (str) – Property Name

  • cb (EventArgsCallbackT) – Callback

Return type:

None

add_event_vetoable_change_events_disposing(name, cb)

Adds a listener for an event.

Event is invoked when the property listener is about to be disposed.

The callback EventArgs.event_data will contain a UNO com.sun.star.lang.EventObject struct.

Parameters:
  • name (str) – Property Name

  • cb (EventArgsCallbackT) – Callback

Return type:

None

add_event_window_activated(cb)

Adds a listener for an event.

Event is invoked when a window is activated.

The callback EventArgs.event_data will contain a UNO com.sun.star.langEventObject struct.

Return type:

None

Parameters:

cb (Any) –

add_event_window_closed(cb)

Adds a listener for an event.

Event is invoked when a window has been closed.

The callback EventArgs.event_data will contain a UNO com.sun.star.lang.EventObject struct.

Return type:

None

Parameters:

cb (Any) –

add_event_window_closing(cb)

Adds a listener for an event.

Event is invoked when a window is in the process of being closed.

The callback EventArgs.event_data will contain a UNO com.sun.star.lang.EventObject struct.

Return type:

None

Parameters:

cb (Any) –

add_event_window_deactivated(cb)

Adds a listener for an event.

Event is invoked when a window is deactivated.

The callback EventArgs.event_data will contain a UNO com.sun.star.lang.EventObject struct.

Return type:

None

Parameters:

cb (Any) –

add_event_window_events_disposing(cb)

Adds a listener for an event.

Event is invoked when the broadcaster is about to be disposed.

The callback EventArgs.event_data will contain a UNO com.sun.star.lang.EventObject struct.

Return type:

None

Parameters:

cb (Any) –

add_event_window_hidden(cb)

Adds a listener for an event.

Event is invoked when the window has been hidden.

The callback EventArgs.event_data will contain a UNO com.sun.star.awt.WindowEvent struct.

Return type:

None

Parameters:

cb (Any) –

add_event_window_minimized(cb)

Adds a listener for an event.

Event is invoked when a window is iconified.

The callback EventArgs.event_data will contain a UNO com.sun.star.lang.EventObject struct.

Return type:

None

Parameters:

cb (Any) –

add_event_window_moved(cb)

Adds a listener for an event.

Event is invoked when the window has been moved.

The callback EventArgs.event_data will contain a UNO com.sun.star.awt.WindowEvent struct.

Return type:

None

Parameters:

cb (Any) –

add_event_window_normalized(cb)

Adds a listener for an event.

Event is invoked when a window is deiconified.

The callback EventArgs.event_data will contain a UNO com.sun.star.lang.EventObject struct.

Return type:

None

Parameters:

cb (Any) –

add_event_window_opened(cb)

Adds a listener for an event.

Event is invoked when a window has been opened.

The callback EventArgs.event_data will contain a UNO com.sun.star.lang.EventObject struct.

Return type:

None

Parameters:

cb (Any) –

add_event_window_paint(cb)

Adds a listener for an event.

Event Is invoked when a region of the window became invalid, e.g. when another window has been moved away.

The callback EventArgs.event_data will contain a UNO com.sun.star.awt.PaintEvent struct.

Return type:

None

Parameters:

cb (Any) –

add_event_window_resized(cb)

Adds a listener for an event.

Event is invoked when the window has been resized.

The callback EventArgs.event_data will contain a UNO com.sun.star.awt.WindowEvent struct.

Return type:

None

Parameters:

cb (Any) –

add_event_window_shown(cb)

Adds a listener for an event.

Event is invoked when the window has been shown.

The callback EventArgs.event_data will contain a UNO com.sun.star.awt.WindowEvent struct.

Return type:

None

Parameters:

cb (Any) –

add_focus_listener(listener)

Adds a focus listener to the object.

Return type:

None

Parameters:

listener (com.sun.star.awt.XFocusListener) –

add_key_listener(listener)

Adds a key listener to the object.

Return type:

None

Parameters:

listener (com.sun.star.awt.XKeyListener) –

add_mouse_listener(listener)

Adds a mouse listener to the object.

Return type:

None

Parameters:

listener (com.sun.star.awt.XMouseListener) –

add_mouse_motion_listener(listener)

Adds a mouse motion listener to the object.

Return type:

None

Parameters:

listener (com.sun.star.awt.XMouseMotionListener) –

add_paint_listener(listener)

Adds a paint listener to the object.

Return type:

None

Parameters:

listener (com.sun.star.awt.XPaintListener) –

add_top_window_listener(listener)

Adds the specified top window listener to receive window events from this window.

Return type:

None

Parameters:

listener (com.sun.star.awt.XTopWindowListener) –

add_window_listener(listener)

Adds a window listener to the object.

Return type:

None

Parameters:

listener (com.sun.star.awt.XWindowListener) –

control_factory(dialog_ctrl)

Gets a control as a DialogControlBase control.

Parameters:

dialog_ctrl (XControl) – Control.

Returns:

Returns a DialogControlBase such as CtlButton or CtlCheckBox if found, else None

Return type:

DialogControlBase | None

convert_point_to_logic(point, target_unit)

Converts the given Point, which is specified in pixels, into the given logical unit.

Raises:

com.sun.star.lang.IllegalArgumentExceptionIllegalArgumentException.

Returns:

Converted Point

Return type:

Point

Parameters:
  • point (Point) –

  • target_unit (int | MeasureUnitEnum) –

Hint

  • MeasureUnitEnum can be imported from ooo.dyn.util.measure_unit

convert_point_to_pixel(point, source_unit)

Converts the given Point, which is specified in the given logical unit, into pixels.

Raises:

com.sun.star.lang.IllegalArgumentExceptionIllegalArgumentException.

Returns:

Converted Point

Return type:

Point

Parameters:
  • point (Point) –

  • source_unit (int | MeasureUnitEnum) –

Hint

  • MeasureUnitEnum can be imported from ooo.dyn.util.measure_unit

convert_size_to_logic(size, target_unit)

Converts the given Size, which is specified in pixels, into the given logical unit.

Raises:

com.sun.star.lang.IllegalArgumentExceptionIllegalArgumentException.

Returns:

Converted Point

Return type:

Point

Parameters:
  • size (Size) –

  • target_unit (int | MeasureUnitEnum) –

Hint

  • MeasureUnitEnum can be imported from ooo.dyn.util.measure_unit

convert_size_to_pixel(size, source_unit)

Converts the given Size, which is specified in the given logical unit, into pixels.

Raises:

com.sun.star.lang.IllegalArgumentExceptionIllegalArgumentException.

Returns:

Converted Point

Return type:

Point

Parameters:
  • size (Size) –

  • source_unit (int | MeasureUnitEnum) –

Hint

  • MeasureUnitEnum can be imported from ooo.dyn.util.measure_unit

create_peer(toolkit=None, parent=None)

Creates a child window on the screen.

If the parent is None, then the desktop window of the toolkit is the parent.

Parameters:
  • toolkit (XToolkit, optional) – The toolkit to use. Defaults to None.

  • parent (XWindowPeer, optional) – The parent window. Defaults to None.

Return type:

None

dispose()

Disposes the dialog

Return type:

None

end_dialog(result)

Hides the dialog and then causes XDialog.execute() to return with the given result value.

Return type:

None

Parameters:

result (int) –

end_execute()

Hides the dialog and then causes XDialog.execute() to return.

Return type:

None

execute()

Runs the dialog modally: shows it, and waits for the execution to end.

Returns an exit code (e.g., indicating the button that was used to end the execution).

Return type:

int

find_control(name)

Finds control by name

Parameters:

name (str) – Name to find

Returns:

Control

Return type:

XControl

find_controls(control_type, dialog_ctrl=None)

Finds controls by type.

Parameters:
  • control_type (ControlT) – Control type.

  • dialog_ctrl (XControl, optional) – Control. Defaults to Instance control.

Returns:

List of controls.

Return type:

List[ControlT]

find_radio_siblings(radio_button, dialog_ctrl=None)

Given the name of the first radio button of a group, return all the controls of the group.

For dialogs, radio buttons are considered of the same group when their tab indexes are contiguous.

Parameters:
  • radio_button (str) – Specifies the exact name of the 1st radio button of the group.

  • dialog_ctrl (XControl, optional) – Control. Defaults to Instance control.

Returns:

List of the names of the 1st and the next radio buttons. belonging to the same group in their tab index order. does not include the first button.

Return type:

List[CtlRadioButton]

See also

get_radio_group_value().

fire_event_properties_change(names)

Fires a sequence of PropertyChangeEvents

Parameters:

names (Iterable[str]) – Sequence of property names to fire event for.

Return type:

None

get_context()

Gets the context of the control.

Return type:

XInterface

get_control(name)

Returns the control with the specified name.

Return type:

XControl

Parameters:

name (str) –

get_control_class_id(dialog_ctrl)

Gets control class id.

Parameters:

dialog_ctrl (XControl) – Control.

Returns:

class id.

Return type:

str

get_control_name(dialog_ctrl)

Get the name of a control.

Parameters:

dialog_ctrl (XControl) – Control.

Returns:

control name.

Return type:

str

get_control_props()

Gets property set for a control model

Parameters:

control_model (Any) – control model

Returns:

Property set

Return type:

XPropertySet | None

get_controls()

Returns all controls.

Return type:

Tuple[XControl, ...]

get_controls_arr(dialog_ctrl)

Gets all controls for a given control.

Parameters:

dialog_ctrl (XControl) – control.

Returns:

controls.

Return type:

Tuple[XControl, …]

get_dialog_controls_arr()

Gets all controls for the dialog

Returns:

controls

Return type:

Tuple[XControl, …]

get_model()

Gets the Model for the control

Return type:

UnoControlDialogModel

get_name_container(dialog_ctrl)

Gets Name container from control.

Parameters:

dialog_ctrl (XControl) – Dialog control.

Returns:

Name Container.

Return type:

XNameContainer

get_peer()

Gets the peer which was previously created or set.

Return type:

XWindowPeer

get_pos_size()

Gets the outer bounds of the window.

Return type:

Rectangle

get_property_set()

Gets the property set for this control

Return type:

XPropertySet

get_radio_group_value(dialog_ctrl, radio_button)

Get a radio button group. Similar to find_radio_siblings() but also includes first radio button.

Parameters:
  • dialog_ctrl (XControl) – Control.

  • radio_button (str) – Name of the first radio button of the group.

Returns:

Value of the selected radio button.

Return type:

Any

See also

find_radio_siblings().

get_title()

Gets the title of the dialog.

Return type:

str

get_uno_srv_name()

Returns com.sun.star.awt.UnoControlDialog

Return type:

str

get_view()

Gets the view of this control.

Return type:

UnoControlDialog

get_view_ctl()
Return type:

XControl

get_window(dialog_ctrl)

Gets dialog window.

Parameters:

dialog_ctrl (XControl) – dialog control.

Returns:

Top window instance.

Return type:

XTopWindow

insert_button(*, label, x, y, width, height=20, btn_type=None, name='', dialog_ctrl=None, **props)

Insert Button Control.

Parameters:
  • label (str) – Button Label.

  • x (int, UnitT) – X coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • y (int, UnitT) – Y coordinate Pixels or UnitT. If -1, the dialog Position is not set.

  • width (int, UnitT) – Width in Pixels or UnitT. If -1, the dialog Size is not set.

  • height (int, UnitT, optional) – Height in Pixels or UnitT. Defaults to 20. If -1, the dialog Size is not set.

  • btn_type (PushButtonType | None, optional) – Type of Button.

  • name (str, optional) – Name of button. Must be a unique name. If empty, a unique name is generated.

  • dialog_ctrl (XControl, optional) – control. Defaults to class instance.

  • props (dict, optional) – Extra properties to set for control.

Raises:

DialogError – If unable to create button control.

Returns:

Button control.

Return type:

CtlButton

Hint

  • PushButtonType can be imported from ooo.dyn.awt.push_button_type.

insert_check_box(*, label, x, y, width, height=8, tri_state=True, state=TriStateKind.CHECKED, border=BorderKind.BORDER_3D, name='', dialog_ctrl=None, **props)

Inserts a check box control.

Parameters:
  • label (str) – Checkbox label text.

  • x (int, UnitT) – X coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • y (int, UnitT) – Y coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • width (int,, UnitT) – Width in Pixels or UnitT. If -1, the dialog Size is not set.

  • height (int, UnitT, optional) – Height in Pixels or UnitT. Defaults to 8. If -1, the dialog Size is not set.

  • tri_state (TriStateKind, optional) – Specifies that the control may have the state “don’t know”. Defaults to True.

  • state (TriStateKind, optional) – Specifies the state of the control.Defaults to TriStateKind.CHECKED.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • name (str, optional) – Name of Checkbox. Must be a unique name. If empty, a unique name is generated.

  • dialog_ctrl (XControl, optional) – control. Defaults to class instance.

  • props (dict, optional) – Extra properties to set for control.

Raises:

DialogError – If unable to create checkbox control.

Returns:

Check box control.

Return type:

CtlCheckBox

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

  • TriStateKind can be imported from ooodev.utils.kind.tri_state_kind.

insert_combo_box(*, entries, x, y, width, height=20, max_text_len=0, drop_down=True, read_only=False, border=BorderKind.BORDER_3D, name='', dialog_ctrl=None, **props)

Insert a combo box control.

Parameters:
  • entries (Iterable[str]) – Combo box entries.

  • x (int, UnitT) – X coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • y (int, UnitT) – Y coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • width (int, UnitT) – Width in Pixels or UnitT. If -1, the dialog Size is not set.

  • height (int, UnitT, optional) – Height in Pixels or UnitT. Defaults to 20. If -1, the dialog Size is not set.

  • max_text_len (int, optional) – Specifies the maximum character count, There’s no limitation, if set to 0. Defaults to 0.

  • drop_down (bool, optional) – Specifies if the control has a drop down button. Defaults to True.

  • read_only (bool, optional) – Specifies that the content of the control cannot be modified by the user. Defaults to False.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • name (str, optional) – Name of button. Must be a unique name. If empty, a unique name is generated.

  • dialog_ctrl (XControl, optional) – control. Defaults to class instance.

  • props (dict, optional) – Extra properties to set for control.

Raises:

DialogError – If unable to create combo box control.

Returns:

Combo box control.

Return type:

CtlComboBox

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

insert_currency_field(*, x, y, width, height=20, value=0.0, min_value=-1000000.0, max_value=1000000.0, spin_button=False, increment=1, accuracy=2, border=BorderKind.BORDER_3D, name='', dialog_ctrl=None, **props)

Inserts a currency control.

Parameters:
  • x (int, UnitT) – X coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • y (int, UnitT) – Y coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • width (int, UnitT) – Width in Pixels or UnitT. If -1, the dialog Size is not set.

  • height (int, UnitT, optional) – Height in Pixels or UnitT. Defaults to 20. If -1, the dialog Size is not set.

  • value (float, optional) – Control Value. Defaults to 0.0.

  • min_value (float, optional) – Specifies the smallest value that can be entered in the control. Defaults to -1000000.0.

  • max_value (float, optional) – Specifies the largest value that can be entered in the control. Defaults to 1000000.0.

  • spin_button (bool, optional) – When True, a spin button is present. Defaults to False.

  • increment (int, optional) – The step when the spin button is pressed. Defaults to 1.

  • accuracy (int, optional) – Specifies the decimal accuracy. Default is 2 decimal digits.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • name (str, optional) – Name of button. Must be a unique name. If empty, a unique name is generated.

  • dialog_ctrl (XControl, optional) – control. Defaults to class instance.

  • props (dict, optional) – Extra properties to set for control.

Return type:

CtlCurrencyField

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

Raises:

DialogError – If unable to create currency field box control.

Returns:

Currency field control.

Return type:

CtlCurrencyField

Parameters:
  • x (int | UnitT) –

  • y (int | UnitT) –

  • width (int | UnitT) –

  • height (int | UnitT) –

  • value (float) –

  • min_value (float) –

  • max_value (float) –

  • spin_button (bool) –

  • increment (int) –

  • accuracy (int) –

  • border (BorderKind) –

  • name (str) –

  • dialog_ctrl (XControl | None) –

  • props (Any) –

insert_date_field(*, x, y, width, height=20, date_value=None, min_date=datetime.datetime(1900, 1, 1, 0, 0), max_date=datetime.datetime(2200, 12, 31, 0, 0), drop_down=True, date_format=DateFormatKind.SYSTEM_SHORT, border=BorderKind.BORDER_3D, name='', dialog_ctrl=None, **props)

Create a new control of type DateField in the actual dialog.

Parameters:
  • x (int, UnitT) – X coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • y (int, UnitT) – Y coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • width (int, UnitT) – Width in Pixels or UnitT. If -1, the dialog Size is not set.

  • height (int, UnitT, optional) – Height in Pixels or UnitT. Defaults to 20. If -1, the dialog Size is not set.

  • date_value (datetime.datetime | None, optional) – Specifics control datetime. Defaults to None.

  • min_date (datetime.datetime, optional) – Specifics control min datetime. Defaults to datetime(1900, 1, 1, 0, 0, 0, 0).

  • max_date (datetime.datetime, optional) – Specifics control Min datetime. Defaults to datetime(2200, 12, 31, 0, 0, 0, 0).

  • drop_down (bool, optional) – Specifies if the control is a dropdown. Defaults to True.

  • date_format (DateFormatKind, optional) – Date format. Defaults to DateFormatKind.SYSTEM_SHORT.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • name (str, optional) – Name of button. Must be a unique name. If empty, a unique name is generated.

  • dialog_ctrl (XControl, optional) – control. Defaults to class instance.

  • props (dict, optional) – Extra properties to set for control.

Raises:

DialogError – If unable to create date field control.

Returns:

Date field control.

Return type:

CtlDateField

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

  • DateFormatKind can be imported from ooodev.utils.kind.date_format_kind.

insert_file_control(*, x, y, width, height=20, border=BorderKind.BORDER_3D, name='', dialog_ctrl=None, **props)

Create a new control of type FileControl in the actual dialog.

Parameters:
  • x (int, UnitT) – X coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • y (int, UnitT) – Y coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • width (int, UnitT) – Width in Pixels or UnitT. If -1, the dialog Size is not set.

  • height (int, UnitT, optional) – Height in Pixels or UnitT. Defaults to 20. If -1, the dialog Size is not set.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • name (str, optional) – Name of button. Must be a unique name. If empty, a unique name is generated.

  • dialog_ctrl (XControl, optional) – control. Defaults to class instance.

  • props (dict, optional) – Extra properties to set for control.

Raises:

DialogError – If unable to create file control.

Return type:

CtlFile

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

Returns:

File Control.

Return type:

CtlFile

Parameters:
  • x (int | UnitT) –

  • y (int | UnitT) –

  • width (int | UnitT) –

  • height (int | UnitT) –

  • border (BorderKind) –

  • name (str) –

  • dialog_ctrl (XControl | None) –

  • props (Any) –

insert_fixed_line(*, x, y, width, height=1, orientation=OrientationKind.HORIZONTAL, name='', dialog_ctrl=None, **props)

Create a new control of type Fixed Line in the actual dialog.

Parameters:
  • x (int, UnitT) – X coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • y (int, UnitT) – Y coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • width (int, UnitT) – Width in Pixels or UnitT. If -1, the dialog Size is not set.

  • height (int, UnitT, optional) – Height in Pixels or UnitT. Defaults to 1. If -1, the dialog Size is not set.

  • orientation (OrientationKind, optional) – Orientation. Defaults to OrientationKind.HORIZONTAL.

  • name (str, optional) – Name of button. Must be a unique name. If empty, a unique name is generated.

  • dialog_ctrl (XControl, optional) – control. Defaults to class instance.

  • props (dict, optional) – Extra properties to set for control.

Raises:

DialogError – If unable to create fixed line control.

Returns:

Fixed Line Control.

Return type:

CtlFixedLine

Hint

  • OrientationKind can be imported from ooodev.utils.kind.orientation_kind.

insert_formatted_field(*, x, y, width, height=20, value=None, min_value=-1000000.0, max_value=1000000.0, spin_button=False, border=BorderKind.BORDER_3D, name='', dialog_ctrl=None, **props)

Create a new control of type FormattedField in the actual dialog.

Parameters:
  • x (int, UnitT) – X coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • y (int, UnitT) – Y coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • width (int, UnitT) – Width in Pixels or UnitT. If -1, the dialog Size is not set.

  • height (int, UnitT, optional) – Height in Pixels or UnitT. Defaults to 20. If -1, the dialog Size is not set.

  • value (float, optional) – Control Value. Defaults to 0.0.

  • min_value (float, optional) – Specifies the smallest value that can be entered in the control. Defaults to -1000000.0.

  • max_value (float, optional) – Specifies the largest value that can be entered in the control. Defaults to 1000000.0.

  • spin_button (bool, optional) – When True, a spin button is present. Defaults to False.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • name (str, optional) – Name of button. Must be a unique name. If empty, a unique name is generated.

  • dialog_ctrl (XControl, optional) – control. Defaults to class instance.

  • props (dict, optional) – Extra properties to set for control.

Raises:

DialogError – If unable to create formatted field control.

Returns:

Formatted Field.

Return type:

CtlFormattedField

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

insert_group_box(*, x, y, width, height, label='', name='', dialog_ctrl=None, **props)

Create a new control of type GroupBox in the actual dialog.

Parameters:
  • x (int, UnitT) – X coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • y (int, UnitT) – Y coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • width (int, UnitT) – Width in Pixels or UnitT. If -1, the dialog Size is not set.

  • height (int, UnitT, optional) – Height in Pixels or UnitT. If -1, the dialog Size is not set.

  • label (str, optional) – Group box label.

  • name (str, optional) – Name of button. Must be a unique name. If empty, a unique name is generated.

  • dialog_ctrl (XControl, optional) – control. Defaults to class instance.

  • props (dict, optional) – Extra properties to set for control.

Raises:

DialogError – If unable to create group box control.

Returns:

Group box Control.

Return type:

CtlGroupBox

Create a new control of type Hyperlink in the actual dialog.

Parameters:
  • label (str) – Hyperlink label.

  • url (str) – Hyperlink URL.

  • x (int, UnitT) – X coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • y (int, UnitT) – Y coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • width (int, UnitT) – Width in Pixels or UnitT. If -1, the dialog Size is not set.

  • height (int, UnitT, optional) – Height in Pixels or UnitT. Defaults to 20. If -1, the dialog Size is not set.

  • align (AlignKind, optional) – Horizontal alignment. Defaults to AlignKind.LEFT.

  • vert_align (VerticalAlignment, optional) – Vertical alignment. Defaults to VerticalAlignment.TOP.

  • multiline (bool, optional) – Specifies if the control can display multiple lines of text. Defaults to False.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.NONE.

  • name (str, optional) – Name of button. Must be a unique name. If empty, a unique name is generated.

  • dialog_ctrl (XControl, optional) – control. Defaults to class instance.

  • props (dict, optional) – Extra properties to set for control.

Raises:

DialogError – If unable to create Hyperlink control.

Returns:

Hyperlink Control.

Return type:

CtlHyperlinkFixed

Hint

  • AlignKind can be imported from ooodev.utils.kind.align_kind.

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

  • VerticalAlignment can be imported from ooo.dyn.style.vertical_alignment.

insert_image_control(*, x, y, width, height=20, border=BorderKind.BORDER_3D, scale=ImageScaleModeEnum.NONE, image_url='', name='', dialog_ctrl=None, **props)

Create a new control of type ImageControl in the actual dialog.

Parameters:
  • x (int, UnitT) – X coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • y (int, UnitT) – Y coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • width (int, , UnitT) – Width in Pixels or UnitT. If -1, the dialog Size is not set.

  • height (int, UnitT, optional) – Height in Pixels or UnitT. Defaults to 20. If -1, the dialog Size is not set.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • image_url (PathOrStr, optional) – Image URL. When setting the value it can be a string or a Path object. If a string is passed it can be a URL or a path to a file. Value such as file:///path/to/image.png and /path/to/image.png are valid. Relative paths are supported.

  • scale (int | ImageScaleModeEnum, optional) – Image scale mode. Defaults to ImageScaleModeEnum.NONE.

  • name (str, optional) – Name of button. Must be a unique name. If empty, a unique name is generated.

  • dialog_ctrl (XControl, optional) – control. Defaults to class instance.

  • props (dict, optional) – Extra properties to set for control.

Raises:

DialogError – If unable to create image control.

Returns:

Image Control.

Return type:

CtlImage

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

  • ImageScaleModeEnum can be imported from ooo.dyn.awt.image_scale_mode.

  • VerticalAlignment can be imported from ooo.dyn.style.vertical_alignment.

insert_label(*, label, x, y, width, height=20, name='', dialog_ctrl=None, **props)

Insert a Fixed Text into a control.

Parameters:
  • label (str) – Contents of label.

  • x (int, UnitT) – X coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • y (int, UnitT) – Y coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • width (int, UnitT) – Width in Pixels or UnitT. If -1, the dialog Size is not set.

  • height (int, UnitT, optional) – Height in Pixels or UnitT. Default 20. If -1, the dialog Size is not set.

  • name (str, optional) – Name of button. Must be a unique name. If empty, a unique name is generated.

  • dialog_ctrl (XControl, optional) – control. Defaults to class instance.

  • props (dict, optional) – Extra properties to set for control.

Raises:

DialogError – If unable to create Fixed Text.

Returns:

Fixed Text Control.

Return type:

CtlFixedText

insert_list_box(*, entries, x, y, width, height=100, drop_down=False, read_only=False, line_count=5, multi_select=False, border=BorderKind.BORDER_3D, name='', dialog_ctrl=None, **props)

Insert a list box control.

Parameters:
  • entries (Iterable[str]) – List box entries.

  • x (int, UnitT) – X coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • y (int, UnitT) – Y coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • width (int, UnitT) – Width in Pixels or UnitT. If -1, the dialog Size is not set.

  • height (int, UnitT, optional) – Height in Pixels or UnitT. Defaults to 100. If -1, the dialog Size is not set.

  • drop_down (bool, optional) – Specifies if the control has a drop down button. Defaults to False.

  • read_only (bool, optional) – Specifies that the content of the control cannot be modified by the user. Defaults to False.

  • line_count (int, optional) – Specifies the number of lines to display. Defaults to 5.

  • multi_select (int, optional) – Specifies if multiple entries can be selected. Defaults to False.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • name (str, optional) – Name of button. Must be a unique name. If empty, a unique name is generated.

  • dialog_ctrl (XControl, optional) – control. Defaults to class instance.

  • props (dict, optional) – Extra properties to set for control.

Raises:

DialogError – If unable to create list box control.

Returns:

List box control.

Return type:

CtlListBox

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

insert_numeric_field(*, x, y, width, height=20, value=None, min_value=-1000000.0, max_value=1000000.0, spin_button=False, increment=1, accuracy=2, border=BorderKind.BORDER_3D, name='', dialog_ctrl=None, **props)

Create a new control of type NumericField in the actual dialog.

Parameters:
  • x (int, UnitT) – X coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • y (int, UnitT) – Y coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • width (int, UnitT) – Width in Pixels or UnitT. If -1, the dialog Size is not set.

  • height (int, UnitT, optional) – Height in Pixels or UnitT. Default 20. If -1, the dialog Size is not set.

  • value (float, optional) – Control Value. Defaults to 0.0.

  • min_value (float, optional) – Specifies the smallest value that can be entered in the control. Defaults to -1000000.0.

  • max_value (float, optional) – Specifies the largest value that can be entered in the control. Defaults to 1000000.0.

  • spin_button (bool, optional) – When True, a spin button is present. Defaults to False.

  • increment (int, optional) – The step when the spin button is pressed. Defaults to 1.

  • accuracy (int, optional) – Specifies the decimal accuracy. Default is 2 decimal digits

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • name (str, optional) – Name of button. Must be a unique name. If empty, a unique name is generated.

  • dialog_ctrl (XControl, optional) – control. Defaults to class instance.

  • props (dict, optional) – Extra properties to set for control.

Raises:

DialogError – If unable to create numeric field control.

Returns:

Numeric Field Control.

Return type:

CtlNumericField

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

insert_password_field(*, text, x, y, width, height=20, border=BorderKind.NONE, name='', dialog_ctrl=None, **props)

Inserts a password field.

Parameters:
  • text (str) – Text value.

  • x (int, UnitT) – X coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • y (int, UnitT) – Y coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • width (int, UnitT) – Width in Pixels or UnitT. If -1, the dialog Size is not set.

  • height (int, UnitT, optional) – Height in Pixels or UnitT. Defaults to 20. If -1, the dialog Size is not set.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.NONE.

  • name (str, optional) – Name of button. Must be a unique name. If empty, a unique name is generated.

  • dialog_ctrl (XControl, optional) – control. Defaults to class instance.

  • props (dict, optional) – Extra properties to set for control.

Raises:

DialogError – If unable to create text field.

Returns:

Text Field Control.

Return type:

CtlTextEdit

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

See also

insert_text_field().

insert_pattern_field(*, x, y, width, height=20, edit_mask='', literal_mask='', border=BorderKind.BORDER_3D, dialog_ctrl=None, name='', **props)

Create a new control of type PatternField in the actual dialog.

Parameters:
  • x (int, UnitT) – X coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • y (int, UnitT) – Y coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • width (int, UnitT) – Width in Pixels or UnitT. If -1, the dialog Size is not set.

  • height (int, UnitT, optional) – Height in Pixels or UnitT. Default``20``. If -1, the dialog Size is not set.

  • edit_mask (str, optional) – Specifies a character code that determines what the user may enter. Defaults to "".

  • literal_mask (str, optional) – Specifies the initial values that are displayed in the pattern field. Defaults to "".

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • name (str, optional) – Name of button. Must be a unique name. If empty, a unique name is generated.

  • dialog_ctrl (XControl, optional) – control. Defaults to class instance.

  • props (dict, optional) – Extra properties to set for control.

Raises:

DialogError – If unable to create pattern field control.

Returns:

Pattern Field Control.

Return type:

CtlPatternField

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

insert_progress_bar(*, x, y, width, height, min_value=0, max_value=100, value=0, border=BorderKind.BORDER_3D, name='', dialog_ctrl=None, **props)

Create a new control of type Progress Control in the actual dialog.

Parameters:
  • x (int, UnitT) – X coordinate. If -1, the dialog Position is not set.

  • x – X coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • y (int, UnitT) – Y coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • width (int, UnitT) – Width in Pixels or UnitT. If -1, the dialog Size is not set.

  • height (int, UnitT) – Height in Pixels or UnitT. If -1, the dialog Size is not set.

  • min_value (float, optional) – Specifies the smallest value that can be entered in the control. Defaults to 0.

  • max_value (float, optional) – Specifies the largest value that can be entered in the control. Defaults to 100.

  • value (int, optional) – The value initial value of the progress bar. Defaults to 0.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • name (str, optional) – Name of button. Must be a unique name. If empty, a unique name is generated.

  • dialog_ctrl (XControl, optional) – control. Defaults to class instance.

  • props (dict, optional) – Extra properties to set for control.

Raises:

DialogError – If unable to create numeric field control.

Returns:

Progress Bar Control.

Return type:

CtlProgressBar

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

insert_radio_button(*, label, x, y, width, height=20, multiline=False, name='', dialog_ctrl=None, **props)

Create a new control of type RadioButton in the actual dialog.

Parameters:
  • label (str) – Contents of label.

  • x (int, UnitT) – X coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • y (int, UnitT) – Y coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • width (int, UnitT) – Width in Pixels or UnitT. If -1, the dialog Size is not set.

  • height (int, UnitT, optional) – Height in Pixels or UnitT. Default 20. If -1, the dialog Size is not set.

  • multiline (bool, optional) – Specifies if the control can display multiple lines of text. Defaults to False.

  • name (str, optional) – Name of button. Must be a unique name. If empty, a unique name is generated.

  • dialog_ctrl (XControl, optional) – control. Defaults to class instance.

  • props (dict, optional) – Extra properties to set for control.

Raises:

DialogError – If unable to create radio button.

Returns:

Radio button control.

Return type:

CtlRadioButton

insert_scroll_bar(*, x, y, width, height, min_value=0, max_value=100, orientation=OrientationKind.HORIZONTAL, border=BorderKind.BORDER_3D, name='', dialog_ctrl=None, **props)

Create a new control of type ScrollBar in the actual dialog.

Parameters:
  • x (int, UnitT) – X coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • y (int, UnitT) – Y coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • width (int, UnitT) – Width in Pixels or UnitT. If -1, the dialog Size is not set.

  • height (int, UnitT) – Height in Pixels or UnitT. If -1, the dialog Size is not set.

  • min_value (float, optional) – Specifies the smallest value that can be entered in the control. Defaults to 0.

  • max_value (float, optional) – Specifies the largest value that can be entered in the control. Defaults to 100.

  • orientation (OrientationKind, optional) – Orientation. Defaults to OrientationKind.HORIZONTAL.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • name (str, optional) – Name of button. Must be a unique name. If empty, a unique name is generated.

  • dialog_ctrl (XControl, optional) – control. Defaults to class instance.

  • props (dict, optional) – Extra properties to set for control.

Raises:

DialogError – If unable to create scroll bar control.

Returns:

Scroll Bar Control.

Return type:

CtlScrollBar

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

  • OrientationKind can be imported from ooodev.utils.kind.orientation_kind.

insert_spin_button(*, x, y, width, height, min_value=0, max_value=100, orientation=OrientationKind.HORIZONTAL, border=BorderKind.BORDER_3D, name='', dialog_ctrl=None, **props)

Create a new control of type SpinButton in the actual dialog.

Parameters:
  • x (int, UnitT) – X coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • y (int, UnitT) – Y coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • width (int, UnitT) – Width in Pixels or UnitT. If -1, the dialog Size is not set.

  • height (int, UnitT) – Height in Pixels or UnitT. If -1, the dialog Size is not set.

  • min_value (float, optional) – Specifies the smallest value that can be entered in the control. Defaults to 0.

  • max_value (float, optional) – Specifies the largest value that can be entered in the control. Defaults to 100.

  • orientation (OrientationKind, optional) – Orientation. Defaults to OrientationKind.HORIZONTAL.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • name (str, optional) – Name of button. Must be a unique name. If empty, a unique name is generated.

  • dialog_ctrl (XControl, optional) – control. Defaults to class instance.

  • props (dict, optional) – Extra properties to set for control.

Raises:

DialogError – If unable to create scroll bar control.

Returns:

Scroll Bar Control.

Return type:

CtlSpinButton

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

  • OrientationKind can be imported from ooodev.utils.kind.orientation_kind.

insert_tab_control(*, x, y, width, height=1, border=BorderKind.NONE, name='', dialog_ctrl=None)

Create a new control of type tab in the actual dialog.

Parameters:
  • x (int, UnitT) – X coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • y (int, UnitT) – Y coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • width (int, UnitT) – Width in Pixels or UnitT. If -1, the dialog Size is not set.

  • height (int, UnitT, optional) – Height in Pixels or UnitT. Defaults to 1. If -1, the dialog Size is not set.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.NONE.

  • name (str, optional) – Name of button. Must be a unique name. If empty, a unique name is generated.

  • dialog_ctrl (XControl, optional) – control. Defaults to class instance.

Raises:

DialogError – If unable to create tab control.

Returns:

Tab Control.

Return type:

CtlTabPageContainer

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

See also

insert_tab_page().

insert_tab_page(*, tab_ctrl, title, tab_position, name='', dialog_ctrl=None, **props)

Create a new control of type Tab Page in the actual tab control.

Parameters:
  • tab_ctrl (CtlTabPageContainer) – Tab Container.

  • title (str) – Tab title.

  • tab_position (int) – Tab position.

  • name (str, optional) – Name of button. Must be a unique name. If empty, a unique name is generated.

  • dialog_ctrl (XControl, optional) – control. Defaults to class instance.

  • props (dict, optional) – Extra properties to set for control.

Raises:

DialogError – If unable to create tab page control.

Returns:

Tab Page Control.

Return type:

CtlTabPage

See also

insert_tab_control().

insert_table_control(*, x, y, width, height, row_header=True, col_header=True, grid_lines=False, scroll_bars=HorzVertKind.NONE, border=BorderKind.BORDER_3D, name='', dialog_ctrl=None, **props)

Create a new control of type TableControl in the actual dialog.

To add data to the table use set_table_data().

Parameters:
  • x (int, UnitT) – X coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • y (int, UnitT) – Y coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • width (int, UnitT) – Width in Pixels or UnitT. If -1, the dialog Size is not set.

  • height (int, UnitT) – Height in Pixels or UnitT. If -1, the dialog Size is not set.

  • row_header (bool, optional) – Specifies if the control has a row header. Defaults to True.

  • col_header (bool, optional) – Specifies if the control has a column header. Defaults to True.

  • grid_lines (bool, optional) – Specifies if the control has grid lines. when True horizontal and vertical lines are painted between the grid cells. Defaults to False.

  • scroll_bars (HorzVertKind, optional) – Specifies if the control has scroll bars. Scrollbars always appear dynamically when they are needed. Defaults to HorzVertKind.NONE.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • name (str, optional) – Name of button. Must be a unique name. If empty, a unique name is generated.

  • dialog_ctrl (XControl, optional) – control. Defaults to class instance.

  • props (dict, optional) – Extra properties to set for control.

Raises:

DialogError – If unable to create table control.

Returns:

Table Control.

Return type:

CtlGrid

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

  • HorzVertKind can be imported from ooodev.utils.kind.horz_ver_kind.

See also

set_table_data().

insert_text_field(*, x, y, width, height=20, text='', echo_char='', border=BorderKind.NONE, name='', dialog_ctrl=None, **props)

Inserts a text Field.

Parameters:
  • x (int, UnitT) – X coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • y (int, UnitT) – Y coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • width (int, UnitT) – Width in Pixels or UnitT. If -1, the dialog Size is not set.

  • height (int, UnitT, optional) – Height in Pixels or UnitT. Defaults to 20. If -1, the dialog Size is not set.

  • text (str, optional) – Text value.

  • echo_char (str, optional) – Character used for masking. Must be a single character.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.NONE.

  • name (str, optional) – Name of button. Must be a unique name. If empty, a unique name is generated.

  • dialog_ctrl (XControl, optional) – control. Defaults to class instance.

  • props (dict, optional) – Extra properties to set for control.

Raises:

DialogError – If unable to create text field.

Returns:

Text Field Control.

Return type:

CtlTextEdit

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

insert_time_field(*, x, y, width, height=20, time_value=None, min_time=datetime.time(0, 0), max_time=datetime.time(23, 59, 59, 999999), time_format=TimeFormatKind.SHORT_24H, spin_button=True, border=BorderKind.BORDER_3D, name='', dialog_ctrl=None, **props)

Create a new control of type TimeField in the actual dialog.

Parameters:
  • x (int, UnitT) – X coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • y (int, UnitT) – Y coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • width (int, UnitT) – Width in Pixels or UnitT. If -1, the dialog Size is not set.

  • height (int, UnitT, optional) – Height in Pixels or UnitT. Defaults to 20. If -1, the dialog Size is not set.

  • time_value (datetime.time | None, optional) – Specifics the control time. Defaults to None.

  • min_time (datetime.time, optional) – Specifics control min time. Defaults to time(0, 0, 0, 0).

  • max_time (datetime.time, optional) – Specifics control min time. Defaults to a time(23, 59, 59, 999_999).

  • time_format (TimeFormatKind, optional) – Date format. Defaults to TimeFormatKind.SHORT_24H.

  • spin_button (bool, optional) – When True, a spin button is present. Defaults to True.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • name (str, optional) – Name of button. Must be a unique name. If empty, a unique name is generated.

  • dialog_ctrl (XControl, optional) – control. Defaults to class instance.

  • props (dict, optional) – Extra properties to set for control.

Raises:

DialogError – If unable to create time field control.

Returns:

Time field control.

Return type:

CtlTimeField

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

  • TimeFormatKind can be imported from ooodev.utils.kind.time_format_kind.

insert_tree_control(*, x, y, width, height, border=BorderKind.BORDER_3D, name='', dialog_ctrl=None, **props)

Create a new control of type Tree in the actual dialog.

Parameters:
  • x (int , UnitT) – X coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • y (int , UnitT) – Y coordinate in Pixels or UnitT. If -1, the dialog Position is not set.

  • width (int , UnitT) – Width in Pixels or UnitT. If -1, the dialog Size is not set.

  • height (int , UnitT) – Height in Pixels or UnitT. If -1, the dialog Size is not set.

  • border (BorderKind, optional) – Border option. Defaults to BorderKind.BORDER_3D.

  • name (str, optional) – Name of button. Must be a unique name. If empty, a unique name is generated.

  • dialog_ctrl (XControl, optional) – control. Defaults to class instance.

  • props (dict, optional) – Extra properties to set for control.

Raises:

DialogError – If unable to create Tree control.

Returns:

Tree Control.

Return type:

CtlTree

Hint

  • BorderKind can be imported from ooodev.utils.kind.border_kind.

is_design_mode()

Returns True if the control is in design mode, False otherwise.

Return type:

bool

is_transparent()

Returns True if the control is transparent, False otherwise.

Return type:

bool

remove_control(ctl)

Removes the given control from the container.

Return type:

None

Parameters:

ctl (com.sun.star.awt.XControl) –

remove_event_focus_events_disposing(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_focus_gained(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_focus_lost(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_key_events_disposing(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_key_pressed(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_key_released(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_listener(listener)

Removes an event listener from the component.

Parameters:

listener (XEventListener) – The event listener to be removed.

Return type:

None

remove_event_mouse_dragged(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_mouse_entered(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_mouse_events_disposing(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_mouse_exited(cb)

Removes a listener for an event.

Return type:

None

Parameters:

cb (Any) –

remove_event_mouse_motion_events_disposing(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_mouse_moved(cb)

Removes a listener for an event.

Return type:

None

Parameters:

cb (Any) –

remove_event_mouse_pressed(cb)

Removes a listener for an event.

Event is invoked when a mouse button has been pressed on a window.

Return type:

None

Parameters:

cb (Any) –

remove_event_mouse_released(cb)

Removes a listener for an event.

Return type:

None

Parameters:

cb (Any) –

remove_event_observer(observer)

Removes an observer

Parameters:

observer (EventObserver) – One or more observers to add.

Returns:

True if observer has been removed; Otherwise, False.

Return type:

bool

remove_event_paint_events_disposing(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_properties_listener()

Remove Properties Listener

Return type:

None

remove_event_property_change(name)

Removes a listener for an event

Parameters:

name (str) – Property Name

Return type:

None

remove_event_property_change_events_disposing(name)

Removes a listener for an event

Parameters:

name (str) – Property Name

Return type:

None

remove_event_top_window_events_disposing(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_vetoable_change(name)

Removes a listener for an event

Parameters:

name (str) – Property Name

Return type:

None

remove_event_vetoable_change_events_disposing(name)

Removes a listener for an event

Parameters:

name (str) – Property Name

Return type:

None

remove_event_window_activated(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_window_closed(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_window_closing(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_window_deactivated(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_window_events_disposing(cb)

Removes a listener for an event.

Return type:

None

Parameters:

cb (Any) –

remove_event_window_hidden(cb)

Removes a listener for an event.

Return type:

None

Parameters:

cb (Any) –

remove_event_window_minimized(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_window_moved(cb)

Removes a listener for an event.

Return type:

None

Parameters:

cb (Any) –

remove_event_window_normalized(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_window_opened(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_window_paint(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_window_resized(cb)

Removes a listener for an event.

Return type:

None

Parameters:

cb (Any) –

remove_event_window_shown(cb)

Removes a listener for an event.

Return type:

None

Parameters:

cb (Any) –

remove_focus_listener(listener)

Removes the specified focus listener from the listener list.

Return type:

None

Parameters:

listener (com.sun.star.awt.XFocusListener) –

remove_key_listener(listener)

Removes the specified key listener from the listener list.

Return type:

None

Parameters:

listener (com.sun.star.awt.XKeyListener) –

remove_mouse_listener(listener)

Removes the specified mouse listener from the listener list.

Return type:

None

Parameters:

listener (com.sun.star.awt.XMouseListener) –

remove_mouse_motion_listener(listener)

Removes the specified mouse motion listener from the listener list.

Return type:

None

Parameters:

listener (com.sun.star.awt.XMouseMotionListener) –

remove_paint_listener(listener)

Removes the specified paint listener from the listener list.

Return type:

None

Parameters:

listener (com.sun.star.awt.XPaintListener) –

remove_top_window_listener(listener)

Removes the specified top window listener so that it no longer receives window events from this window.

Return type:

None

Parameters:

listener (com.sun.star.awt.XTopWindowListener) –

remove_window_listener(listener)

Removes the specified window listener from the listener list.

Return type:

None

Parameters:

listener (com.sun.star.awt.XWindowListener) –

set_context(ctx)

Sets the context of the control.

Return type:

None

Parameters:

ctx (com.sun.star.uno.XInterface) –

set_design_mode(on)

Sets the design mode for use in a design editor.

Normally the control will be painted directly without a peer.

Return type:

None

Parameters:

on (bool) –

set_enable(enable)

Enables or disables the window depending on the parameter.

Return type:

None

Parameters:

enable (bool) –

set_focus()

sets the focus to the window.

Return type:

None

set_help_id(help_id)

Sets the help id so that the standard help button action will show the appropriate help page.

Return type:

None

Parameters:

help_id (str) –

set_menu_bar(menu)

Sets a menu bar.

Return type:

None

Parameters:

menu (com.sun.star.awt.XMenuBar) –

set_model(model)

Sets a model for the control.

Return type:

bool

Parameters:

model (com.sun.star.awt.XControlModel) –

set_pos_size(x, y, width, height, flags=15)

Sets the outer bounds of the window.

Parameters:
  • x (int, UnitT) – The x-coordinate of the window. In Pixels or UnitT.

  • y (int, UnitT) – The y-coordinate of the window. In Pixels or UnitT.

  • width (int, UnitT) – The width of the window. In Pixels or UnitT.

  • height (int, UnitT) – The height of the window. In Pixels or UnitT.

  • flags (int, UnitT) – A combination of com.sun.star.awt.PosSize flags. Default set to PosSize.POSSIZE.

Return type:

None

Note

The Model is in AppFont units where as the View is in Pixels. The values are converted from Pixels to AppFont units and assigned to the model. If the values are passed in as UnitAppFontX, UnitAppFontY, UnitAppFontWidth, or UnitAppFontHeight then they are assigned directly to the model without conversion.

set_status_text(text)

Sets the status text in the status bar of the container.

Return type:

None

Parameters:

text (str) –

set_title(title)

sets the title of the dialog.

Return type:

None

Parameters:

title (str) –

set_visible(visible)

Shows or hides the window depending on the parameter.

Return type:

None

Parameters:

visible (bool) –

subscribe_event(event_name, callback)

Add an event listener to current instance.

Parameters:
  • event_name (str) – Event Name.

  • callback (EventCallback) – Callback of the event listener.

Return type:

None

to_back()

Places this window at the bottom of the stacking order and makes the corresponding adjustment to other visible windows.

Return type:

None

to_front()

Places this window at the top of the stacking order and shows it in front of any other windows.

Return type:

None

trigger_event(event_name, event_args)

Trigger an event on current instance.

Parameters:
  • event_name (str) – Event Name.

  • event_args (EventArgsT) – Event Args.

Return type:

None

unsubscribe_event(event_name, callback)

Remove an event listener from current instance.

Parameters:
  • event_name (str) – Event Name.

  • callback (EventCallback) – Callback of the event listener.

Return type:

None

property component: com.sun.star.awt.UnoControlDialog

UnoControlDialog Component

Return type:

UnoControlDialog

property control: com.sun.star.awt.UnoControlDialog

Returns the control

Return type:

UnoControlDialog

property event_observer: EventObserver

Gets/Sets The Event Observer for this instance.

Return type:

EventObserver

property events_listener_focus: FocusListener

Returns listener

Return type:

FocusListener

property events_listener_key: KeyListener

Returns listener

Return type:

KeyListener

property events_listener_mouse: MouseListener

Returns listener

Return type:

MouseListener

property events_listener_mouse_motion: MouseMotionListener

Returns listener

Return type:

MouseMotionListener

property events_listener_paint: PaintListener

Returns listener

Return type:

PaintListener

property events_listener_properties_change_implement: PropertiesChangeListener

Returns listener

Return type:

PropertiesChangeListener

property events_listener_top_window: TopWindowListener

Returns listener

Return type:

TopWindowListener

property events_listener_window: WindowListener

Returns listener

Return type:

WindowListener

property height: UnitPX

Gets/Sets the height of the control in Pixel units.

When setting can be an integer in Pixels Units or a UnitT.

Returns:

Height of the control.

Return type:

UnitPX

Note

The Height is in Pixel units; however, the model is in AppFont units. This property will convert the AppFont units to Pixel units. When set using UnitAppFontHeight no conversion is done.

property lo_inst: LoInst

Lo Instance

Return type:

LoInst

property model: UnoControlModel

Uno Control Model

Return type:

UnoControlModel

property model_ex: ModelDialog

Gets the extended Model for the control.

This is a wrapped instance for the model property. It add some additional properties and methods to the model.

Return type:

ModelDialog

property name: str

Gets/Sets the name of the control.

Return type:

str

property step: int

Gets/Sets the step of the control.

Return type:

int

property tab_index: int

Gets/Sets the tab index of the control.

Return type:

int

property tag: str

Gets/Sets the tag of the control.

Return type:

str

property title: str

Gets the title of the dialog

Return type:

str

property view: Any

Uno Control

Return type:

UnoControl

property visible: bool

Gets/Sets the visible state for the control

Return type:

bool

property width: UnitPX

Gets the width of the control

Return type:

UnitPX

property x: UnitPX

Gets/Sets the X position for the control in pixel units.

When setting can be an integer in Pixels Units or a UnitT.

Returns:

X position of the control.

Return type:

UnitPX

Note

The X is in Pixel units; however, the model is in AppFont units. This property will convert the AppFont units to Pixel units. When set using UnitAppFontX no conversion is done.

property y: UnitPX

Gets/Sets the Y position for the control in pixel units.

When setting can be an integer in Pixels Units or a UnitT.

Returns:

Y position of the control.

Return type:

UnitPX

Note

The Y is in Pixel units; however, the model is in AppFont units. This property will convert the AppFont units to Pixel units. When set using UnitAppFontY no conversion is done.