I have a form with a grid control. When opening the form it is maximized, I need that the grid control is maximized to the area inside the form, leaving its top left position fixed.
I have managed to adjust the size but the operation of the mouse is not correct. When the mouse passes over the area that the grid originally had, it resizes it to reduce it to that previous size, as if it did not like its new size.
Code: Select all
FormDoc = ThisDatabaseDocument.FormDocuments.GetByName(NomForm)
FormDoc.Component.CurrentController.Frame.ContainerWindow.IsMaximized = True
FormLista = FormDoc.Component.Drawpage.Forms.getByIndex(0)
Dim Fld as Object, Ctl as Object
Dim Ventana As Object, RectVentana As New com.sun.star.awt.Rectangle, RectCtl As New com.sun.star.awt.Rectangle
Ventana = FormDoc.Component.CurrentController.ComponentWindow
RectVentana = Ventana.getPosSize
Fld = FormLista.getByName("Lista")
Ctl = FormDoc.Component.getCurrentController().getControl(Fld)
RectCtl = Ctl.getPosSize()
Ctl.setPosSize(RectCtl.X, RectCtl.Y, RectVentana.Width - RectCtl.X, RectVentana.Height - RectCtl.Y, com.sun.star.awt.PosSize.SIZE)
Thanks.