Skip to content

Commit

Permalink
Add resizeControls function with example in sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
kelsa-pi committed Jan 17, 2021
1 parent 6152cd7 commit 9b38410
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions templates/sidebar_convert/10_main.txt
Expand Up @@ -8,6 +8,7 @@
# =============================================================================

import uno
from com.sun.star.awt.PosSize import POSSIZE
from com.sun.star.awt.MessageBoxButtons import BUTTONS_OK, BUTTONS_OK_CANCEL, BUTTONS_YES_NO, BUTTONS_YES_NO_CANCEL, BUTTONS_RETRY_CANCEL, BUTTONS_ABORT_IGNORE_RETRY
from com.sun.star.awt.MessageBoxButtons import DEFAULT_BUTTON_OK, DEFAULT_BUTTON_CANCEL, DEFAULT_BUTTON_RETRY, DEFAULT_BUTTON_YES, DEFAULT_BUTTON_NO, DEFAULT_BUTTON_IGNORE
from com.sun.star.awt.MessageBoxType import MESSAGEBOX, INFOBOX, WARNINGBOX, ERRORBOX, QUERYBOX
Expand Down Expand Up @@ -90,6 +91,22 @@ class ${APP_NAME}(${APP_NAME}_UI):

${GEN_ACTIONS_CALLBACKS}

# -----------------------------------------------------------
# Window (dialog/panel) events
# -----------------------------------------------------------

def resizeControls(self, dialog):
# # see https://forum.openoffice.org/en/forum/viewtopic.php?f=45&t=85181#
# ratio = 1.1
# margin = 5
# dlg_width = dialog.Size.Width
# # add control names
# controls = ['btnOK', 'lbList', 'cbPrinters']
# for c in controls:
# cntr = dialog.getControl(c)
# width = (dlg_width / ratio) - margin
# cntr.setPosSize(cntr.PosSize.X, cntr.PosSize.Y, width, cntr.PosSize.Height, POSSIZE)
pass

def ${EXEC_FUNCTION_PREFIX}${APP_NAME}(*args):
"""
Expand Down

0 comments on commit 9b38410

Please sign in to comment.