I expect that you need to set this from the sheets draw page

' Gets the Shape of a Control( e. g. to reset the size or Position of the control
' Parameters:
' The 'oContainer' is the Document or a specific sheet of a Calc - Document
' 'CName' is the Name of the Control
Function GetControlShape(oContainer as Object,CName as String)
Dim i as integer
Dim aShape as Object
   For i = 0 to oContainer.DrawPage.Count-1
      aShape = oContainer.DrawPage(i)
If HasUnoInterfaces(aShape, "com.sun.star.drawing.XControlShape") then
         If ashape.Control.Name = CName then
            GetControlShape = aShape
            exit Function
         End If
      End If
   Next
End Function

So, how do I call it?

Sub gcs
  Dim oSize
  oSize = GetControlShape(ThisComponent.Sheets(0), "button1").Size
  Print oSize.Height
  Print oSize.Width
End Sub

In this example, I pass the sheet containing the button with the button name to the "GetControlShape" function. I forget the unit of measure. Hmm, oh yeas, 1" = oSize.Height / 2540

But wait, your units metric. I think life just got easier for you :-), just set to 500 for 1/2 CM I believe.


On 07/30/2011 07:05 PM, Bill Gradwohl wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I've searched and can't figure out how to specify the height of a button
at execution time via a basic macro.

If "Sheet1" contains a button name "OK", how would I specify a button
height of 0.5cm?

The only examples I can find are for buttons on forms, not on a sheet
itself.

- -- Bill Gradwohl
Roatan, Honduras

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAk40jisACgkQ7Orvev+eC8rGHQCgmq3OwAJmVey+UVF051lvj9nj
agYAoIiZ3ZEl5074W6+CpTowdUxilfcl
=U2Iw
-----END PGP SIGNATURE-----


--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
Info:  http://www.pitonyak.org/oo.php


--
Unsubscribe instructions: E-mail to [email protected]
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Reply via email to