 | OO-Snippets: position and size of form-controlsCommons| Keywords | Form, Control, Position, Size |
|---|
| Language | OOBasic |
|---|
| Application | Office |
|---|
| Authors | Andrew Pitonyak Paolo Mantovani
|
|---|
| Supported Versions | |
|---|
| Supported OS | |
|---|
| Question |
How can I get the position and size of form controls?
|
|---|
| Answer | A form control is placed on a drawing shape (com.sun.star.drawing.XControlShape),
so you need to obtain the shape underlying the control to manage his size and pos.
Andrew Pitonyaks Tools Library (module "ModuleControls") supplies some facilities in order to work with form controls.
Check those functions:
GetControlModel()
GetControlShape()
GetControlView()
|
|---|
Sub SeeThingProp
Dim oForm, oControl, iNumControls%, i%
Dim v()
oForm = ThisComponent.Drawpage.Forms.getByName("Standard")
oControl = oForm.getByName("CheckBox")
Dim vShape
Dim vPosition, vSize
Dim s$, vv
vShape = GetControlShape(ThisComponent, "CheckBox")
vPosition = vShape.getPosition()
vSize = vShape.getSize()
s = s & "Position = (" & vPosition.X & ", " & vPosition.Y & ")" & CHR$(10)
s = s & "Height = " & vSize.Height & " Width = " & vSize.Width & CHR$(10)
MsgBox s
End Sub
|
Changelog| Date | User | Modification |
|---|
| 0000-00-00 | and | Initial version |
|