BASIC : How to setup width and height of grid referring to width and height of dialog

From the question,

'Insert Grid into dialog control
oDialogControl.addControl("MyGrid", oGridControl)
oGridControl.setPosSize(15, 50, 730, 280, com.sun.star.awt.PosSize.POSSIZE)

How can I change grid width from 730 to iDlgWidth -15 -15 (15 = left marging & right margin) & grid height from 280 to iDlgHeight - 15 - 15 (15 = top marging & bottom margin) ?

I have tried only

oGridControl.setPosSize(15, 50, iDlgWidth -15 -15, 280, com.sun.star.awt.PosSize.POSSIZE).

It was not fit.

Hello,

The dialog deals with pixels and the control (I believe) with APPFONT. Have previously looked at this for a totally different reason but put it aside. For more on this see → [Solved] Maximize a dialog in Calc at runtime (OpenBASIC)

For a rough solution (actual conversion would be best), this may suffice:

oGridControl.setPosSize(15, 50, (iDlgWidth -30) *2, (iDlgHeight - 30) *1.5, com.sun.star.awt.PosSize.POSSIZE)

You must also consider other controls on the dialog such as labels or buttons.

Dear @Ratslinger,

Thank you so much.