Class CreateDialogPartial

class ooodev.dialog.partial.create_dialog_partial.CreateDialogPartial(lo_inst=None)[source]

Partial for working with dialogs.

Parameters:

lo_inst (LoInst | None) –

__init__(lo_inst=None)[source]

CreateDialogPartial Constructor.

Parameters:

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

Return type:

None

create_dialog(x, y, width, height, title)[source]

Creates a dialog.

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

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

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

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

  • title (str) – Dialog title.

Returns:

An empty dialog. The dialog contains methods for adding controls.

Return type:

Dialog

input_box(title, msg, input_value='', ok_lbl='OK', cancel_lbl='Cancel', is_password=False)[source]

Displays an input box and returns the results.

Parameters:
  • title (str) – Title for the dialog

  • msg (str) – Message to display such as “Input your Name”

  • input_value (str, optional) – Value of input box when first displayed.

  • ok_lbl (str, optional) – OK button Label. Defaults to “OK”.

  • cancel_lbl (str, optional) – Cancel Button Label. Defaults to “Cancel”.

  • is_password (bool, optional) – Determines if the input box is masked for password input. Defaults to False.

Returns:

The value of input or empty string.

Return type:

str

Note

Raises a global event GblNamedEvent.INPUT_BOX_CREATING before creating the dialog. The event args are of type CancelEventArgs. The event_data is a dictionary that contains the following key:

  • msg: The message to display.

  • title: The title of the dialog.

  • input_value: The value of the input box when first displayed.

  • ok_lbl: The label for the OK button.

  • cancel_lbl: The label for the Cancel button.

  • is_password: Determines if the input box is masked for password input.

  • frame: The frame of the dialog. If not set, the frame of the current document is used.

The default frame is None. If set value must be a XFrame object.

If the event is cancelled, the result value of event_data` if set will be returned. Otherwise if the event is not handled, a ``CancelEventError is raised.

msgbox(msg: str) ooo.dyn.awt.message_box_results.MessageBoxResultsEnum[source]
msgbox(msg: str, title: str) ooo.dyn.awt.message_box_results.MessageBoxResultsEnum
msgbox(msg: str, title: str, *, buttons: MessageBoxButtonsEnum | int) ooo.dyn.awt.message_box_results.MessageBoxResultsEnum
msgbox(msg: str, title: str, boxtype: MessageBoxType | int) ooo.dyn.awt.message_box_results.MessageBoxResultsEnum
msgbox(msg: str, title: str, boxtype: MessageBoxType | int, buttons: MessageBoxButtonsEnum | int) ooo.dyn.awt.message_box_results.MessageBoxResultsEnum
msgbox(msg, title='Message', boxtype=MessageBoxType.MESSAGEBOX, buttons=MessageBoxButtonsEnum.BUTTONS_OK)

Simple message box.

Parameters:
  • msg (str) – the message for display.

  • title (str, optional) – the title of the message box. Defaults to “Message”.

  • boxtype (MessageBoxType, optional) – determines the type of message box to display. Defaults to Type.MESSAGEBOX.

  • buttons (MessageBoxButtonsEnum, int, optional) – determines what buttons to display. Defaults to Buttons.BUTTONS_OK.

Returns:

MessageBoxResultsEnum

Return type:

Results

Note

If BoxType is an integer, the following values are valid:

  • 0: MESSAGEBOX

  • 1: INFOBOX

  • 2: WARNINGBOX

  • 3: ERRORBOX

  • 4: QUERYBOX

Note

  • Button press Abort return MessageBoxResultsEnum.CANCEL

  • Button press Cancel return MessageBoxResultsEnum.CANCEL

  • Button press Ignore returns MessageBoxResultsEnum.IGNORE

  • Button press No returns MessageBoxResultsEnum.NO

  • Button press OK returns MessageBoxResultsEnum.OK

  • Button press Retry returns MessageBoxResultsEnum.RETRY

  • Button press Yes returns MessageBoxResultsEnum.YES

Note

Raises a global event GblNamedEvent.MSG_BOX_CREATING before creating the dialog. The event args are of type CancelEventArgs. The event_data is a dictionary that contains the following key:

  • msg: The message to display.

  • title: The title of the dialog.

  • boxtype: The type of message box to display.

  • buttons: The buttons to display.

If the event is cancelled, the result value of event_data` if set will be returned. Otherwise if the event is not handled, a ``CancelEventError is raised.