Class FormCtlDbDateField

Introduction

Class for working with Database Date Field 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: FormCtlDbDateField, *args, **kwargs
) -> None:
    pass

or

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

Class

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

Bases: FormCtlDateField, DataAwareControlModelPartial, UpdateEvents

com.sun.star.form.component.DatabaseDateField 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.DatabaseDateField 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_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_approve_update(cb)

Adds a listener for an event.

Event is invoked to check the current data. If event is canceled then the update 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 update will be canceled if the CancelEventArgs.handled is set to True then the update will be performed.

Return type:

None

Parameters:

cb (Any) –

add_event_down(cb)

Adds a listener for an event.

Event is invoked when the spin field is spun down.

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

Return type:

None

Parameters:

cb (Any) –

add_event_first(cb)

Adds a listener for an event.

Event is invoked when the spin field is set to the lower value.

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

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

Adds a listener for an event.

Event is invoked when the spin field is set to the upper value.

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

Adds a listener for an event.

Event is invoked when the spin field is spun up.

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

Return type:

None

Parameters:

cb (Any) –

add_event_update_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_updated(cb)

Adds a listener for an event.

Event is invoked when an object has finished processing the updates and the data has been successfully written.

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

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_approve_update(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_down(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_first(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_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_last(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_spin_events_disposing(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_up(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_update_events_disposing(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_updated(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_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 bound_field: com.sun.star.beans.XPropertySet

Gets/Sets the name of the field in the data source to which the control is bound.

Return type:

XPropertySet

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 data_field: str

Gets/Sets the name of the field in the data source to which the control is bound.

Return type:

str

property date: date

Gets/Sets the date

Return type:

date

property date_format: DateFormatKind

Gets/Sets the format

Return type:

DateFormatKind

property date_max: date

Gets/Sets the min date

Return type:

date

property date_min: date

Gets/Sets the min date

Return type:

date

property dropdown: bool

Gets/Sets the if the control has a dropdown.

Return type:

bool

property enabled: bool

Gets/Sets the enabled state for the control

Return type:

bool

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

Returns listener

Return type:

ResetListener

property events_listener_spin: SpinListener

Returns listener

Return type:

SpinListener

property events_listener_text: TextListener

Returns listener

Return type:

TextListener

property events_listener_update: UpdateListener

Returns listener

Return type:

UpdateListener

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 help_text: str

Gets/Sets the tip text

Return type:

str

property help_url: str

Gets/Sets the help url

Return type:

str

property input_required: bool

Gets/Sets whether or not input into this field is required, when it is actually bound to a database field.

Return type:

bool

property label_control: com.sun.star.beans.XPropertySet

Gets/Sets references to a control model within the same document which should be used as a label.

Return type:

XPropertySet

property lo_inst: LoInst

Lo Instance

Return type:

LoInst

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

Gets the model for this control

Return type:

DateField

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 printable: bool

Gets/Sets the printable property

Return type:

bool

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 spin: bool

Gets/Sets if the control has a spin button

Return type:

bool

property step: int

Gets/Sets the step

Return type:

int

property strict_format: bool

Gets/Sets the strict format

Return type:

bool

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 text: str

Gets/Sets the text

Return type:

str

property tip_text: str

Gets/Sets the tip text

Return type:

str

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

Gets the view of this control

Return type:

DateField