[Solved] Maximize a dialog in Calc at runtime (OpenBASIC)
Posted: Mon Sep 19, 2016 4:40 pm
I would like to set the dimensions of a dialog so that it fits the screen.
I found something useful on this forum, but the .Width and .Height I get from the container window (see code below) are not ready to use.
In fact, when I assign this values to the Height and Width property of a dialog (see code below), I get an over-sized window.
I manually adjusted this (by errors and trials) and found that dividing these measures by a certain constant I get what I need on my screen:
I'm wondering why: are these properties (ContainerWindow.PosSize.Width vs oDialog.Model.Width) expressed in terms of different units of measurement? Is the container windows actually larger than I suppose (i.e. than the screen)? Why are the two coefficients (for width 2.054 and for height 1.883) different from each other?
Ultimately, is there a better and cleaner way to write "dialog, get the dimensions of the screen"?
Thanks in advance,
Davide
I found something useful on this forum, but the .Width and .Height I get from the container window (see code below) are not ready to use.
Code: Select all
Dim a As Integer, b As Integer
a = ThisComponent.getCurrentController.getFrame.ContainerWindow.PosSize.Width
b = ThisComponent.getCurrentController.getFrame.ContainerWindow.PosSize.Height
Code: Select all
Dim oDialog As Object
DialogLibraries.LoadLibrary("Standard")
oDialog = CreateUnoDialog(DialogLibraries.Standard.MyDialog1)
oDialog.getModel.PositionX = 0
oDialog .getModel.PositionY = 0
oDialog.Model.Width = a
oDialog.Model.Height = b
Code: Select all
oDialog.Model.Width = a / 2.054
oDialog.Model.Height = b / 1.883
Ultimately, is there a better and cleaner way to write "dialog, get the dimensions of the screen"?
Thanks in advance,
Davide