Class FormCtlComboBox

Introduction

Class for working with Combo Box controls in a form.

EventArgsCallbackT

All EventArgsCallbackT callbacks include control_src as a keyword argument.

A callback can be in the format of:

def on_some_event(
    src: Any, event: EventArgs, control_src: FormCtlComboBox, *args, **kwargs
) -> None:
    pass

or

def on_some_event(src: Any, event: EventArgs, *args, **kwargs) -> None:
    # can get control from kwargs
    ctl = cast(FormCtlComboBox, kwargs['control_src'])

Class

class ooodev.form.controls.FormCtlComboBox(ctl, lo_inst=None)[source]

Bases: FormCtlBase, ActionEvents, ItemEvents, TextEvents, ResetEvents

com.sun.star.form.component.ComboBox control

Parameters:
  • ctl (XControl) –

  • lo_inst (LoInst | None) –

__init__(ctl, lo_inst=None)[source]

Constructor

Parameters:
  • ctl (XControl) – Control supporting com.sun.star.form.component.ComboBox service.

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

Return type:

None

Note

If the LoContext manager is use before this class is instantiated, then the Lo instance will be set using the current Lo instance. That the context manager has set. Generally speaking this means that there is no need to set lo_inst when instantiating this class.

See also

Class Forms.

add_event_action_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_action_performed(cb)

Adds a listener for an event.

Event is invoked when an action is performed.

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

Return type:

None

Parameters:

cb (Any) –

add_event_approve_reset(cb)

Adds a listener for an event.

Event is invoked is invoked before a component is reset. If event is canceled then the reset will be canceled.

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

Note

The callback event will be CancelEventArgs. If the CancelEventArgs.cancel is set to True then the reset will be canceled if the CancelEventArgs.handled is set to True then the reset will be performed.

Return type:

None

Parameters:

cb (Any) –

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_item_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_item_state_changed(cb)

Adds a listener for an event.

Event is invoked when an item changes its state.

The callback EventArgs.event_data will contain a UNO com.sun.star.awt.ItemEvent 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_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_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_reset_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_resetted(cb)

Adds a listener for an event.

Event is invoked when a component has been reset.

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

Return type:

None

Parameters:

cb (Any) –

add_event_text_changed(cb)

Adds a listener for an event.

Event is invoked when the text has changed.

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

Return type:

None

Parameters:

cb (Any) –

add_event_text_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_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_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_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) –

apply_styles(*styles)

Applies styles to control

Parameters:

*styles (StyleT) – Styles to apply

Return type:

None

assign_script(interface_name, method_name, script_name, loc, language=LanguageKind.PYTHON, auto_remove_existing=True)

Binds a macro to a form control.

Method is Lo Instance Safe for use with multiple documents.

Parameters:
  • interface_name (str, XInterface) – Interface Name or a UNO object that implements the XInterface.

  • method_name (str) – Method Name.

  • script_name (str) – Script Name.

  • loc (str) – can be user, share, document, and extensions.

  • language (str | LanguageKind, optional) – Language. Defaults to LanguageKind.PYTHON.

  • auto_remove_existing (bool, optional) – Remove existing script. Defaults to True.

Return type:

None

Changed in version 0.47.6: added auto_remove_existing parameter.

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_control()

Gets the control

Return type:

XControl

get_form_component_kind()[source]

Gets the kind of form component this control is

Return type:

FormComponentKind

get_form_name()

Gets form name for the current control

Parameters:

ctl_model (XControlModel) – control model

Returns:

form name on success; Otherwise, empty string.

Return type:

str

get_id()

Gets class id for this control.

Returns:

Class Id if found, Otherwise -1

Return type:

int

get_model()

Gets the model for this control

Return type:

UnoControlModel

get_property(name, default=<object object>)

Get property value

Parameters:
  • name (str) – Property Name.

  • default (Any, optional) – Return value if property value is None.

Returns:

Property value or default.

Return type:

Any

get_property_set()

Gets the property set for this control.

Return type:

XPropertySet

get_uno_srv_name()

Get Uno service name

Return type:

str

get_view()

Gets the view of this control

Return type:

UnoControl

remove_event_action_events_disposing(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_action_performed(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_approve_reset(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

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_item_events_disposing(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_item_state_changed(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_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_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_reset_events_disposing(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_resetted(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_text_changed(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_text_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_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_moved(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_script(interface_name, method_name, remove_params='')

Removes a script from a form control.

Parameters:
  • ctl_props (XPropertySet) – _description_

  • interface_name (str | XInterface) – _description_

  • method_name (str) – _description_

  • remove_params (str, optional) – _description_. Defaults to “”.

Raises:

RemoveScriptError – if there is an error removing the script.

Return type:

None

See also

New in version 0.47.6.

set_design_mode(on)

Sets the design mode for use in a design editor.

Normally the control will be painted directly without a peer.

Parameters:

on (bool) – True to set design mode on; Otherwise, False.

Return type:

None

New in version 0.47.6.

Return type:

None

Parameters:

on (bool) –

set_list_data(data)[source]

Sets the list data

Parameters:

data (Iterable[str]) – List box entries

Return type:

None

set_property(**kwargs)

Set property value

Parameters:

**kwargs (Any) – Variable length Key value pairs used to set properties.

Return type:

None

New in version 0.39.1.

Return type:

None

Parameters:

kwargs (Any) –

property border: BorderKind

Gets/Sets the border style

Return type:

BorderKind

property component_type: int

Gets the form component type.

The return value is a com.sun.star.form.FormComponentType constant.

Returns:

Form component type

Return type:

int

New in version 0.14.1.

property control_shape: com.sun.star.drawing.ControlShape

Gets the owner of the control

Return type:

ControlShape

property drop_down: bool

Gets/Sets the combobox has a drop down button.

Return type:

bool

property enabled: bool

Gets/Sets the enabled state for the control

Return type:

bool

property events_listener_action: ActionListener

Returns listener

Return type:

ActionListener

property events_listener_focus: FocusListener

Returns listener

Return type:

FocusListener

property events_listener_item: ItemListener

Returns listener

Return type:

ItemListener

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_reset: ResetListener

Returns listener

Return type:

ResetListener

property events_listener_text: TextListener

Returns listener

Return type:

TextListener

property events_listener_window: WindowListener

Returns listener

Return type:

WindowListener

property extra_data: TheDict

Extra Data Key Value Pair Dictionary.

Properties can be assigned properties and access like a dictionary and with dot notation.

Note

This is a dictionary object that can be used to store key value pairs. Generally speaking this data is not part of the object’s main data structure and is not saved with the object (document).

This property is used to store data that is not part of the object’s main data structure and can be used however the developer sees fit.

Return type:

TheDict

property lo_inst: LoInst

Lo Instance

Return type:

LoInst

property max_text_len: int

Gets/Sets the maximum character count.

Return type:

int

property model: com.sun.star.form.component.ComboBox

Gets the model for this control

Return type:

ComboBox

property name: str

Gets the name for the control model

Return type:

str

property position: GenericUnitPoint[UnitMM, float]

Gets the Position of the control in UnitMM Values.

Return type:

GenericUnitPoint[UnitMM, float]

property read_only: bool

Gets/Sets the read-only property

Return type:

bool

property size: GenericUnitSize[UnitMM, float]

Gets the size of the control in UnitMM Values.

Return type:

GenericUnitSize[UnitMM, float]

property tab_index: int

Gets/Sets the tab index

Return type:

int

property tab_stop: bool

Gets/Sets the tab stop property

Return type:

bool

property tag: str

Gets/Sets the tag

Return type:

str

property view: com.sun.star.form.control.ComboBox

Gets the view of this control

Return type:

ComboBox