OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Prog. setting of font characteristics of Control on a Dialog

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
Dennis Jelavic
Power User
Power User


Joined: 13 Nov 2008
Posts: 67

PostPosted: Wed Mar 24, 2010 10:44 pm    Post subject: Prog. setting of font characteristics of Control on a Dialog Reply with quote

I am creating a dialog at run time and am using the following code to create a label on the dialog:

Code:
  label1Model = initDialogModel.createInstance( "com.sun.star.awt.UnoControlFixedTextModel" )
  label1Model.PositionX = 15
  label1Model.PositionY = 20
  label1Model.Width = 200
  label1Model.Height = 20
  label1Model.Label = "Enter Financial Year (as mm/yyyy):"
  fontDes = createUnoStruct("com.sun.star.awt.FontDescriptor")
  fontDes =label1Model.FontDescriptor
  fontDes.Height = 10
  label1Model.FontDescriptor = fontDes


This works fine apart from when I want to set the weight for characters in the label with

fontDes.Weight = nn

No matter what value I set in this statement, it has no effect. I am not even sure of what value range can be used in this statement.

Can anyone throw any light on this please?
Back to top
View user's profile Send private message
B Marcelly
Super User
Super User


Joined: 12 May 2004
Posts: 1453
Location: France

PostPosted: Sat Mar 27, 2010 8:21 am    Post subject: Reply with quote

Hi,
The displayed result depends on the font itself and its capabilities.
Try an existing font name, and a sufficient height, e.g. Arial 10.

fontDes.Weight usable values are :
100 : normal weight
150 : bold
In fact the values are a percentage of the normal weight. Perhaps some fonts offer a range from 50 to 200.
Found by analogy with constants of group com.sun.star.awt.FontWeight.
_________________
Bernard

OpenOffice.org 1.1.5 fr / Apache OpenOffice 4.0.1 / LibreOffice 4.1.0
MS-Windows 7 Home SP1
This forum is spammed, use instead Apache OpenOffice forums
Back to top
View user's profile Send private message Visit poster's website
Dennis Jelavic
Power User
Power User


Joined: 13 Nov 2008
Posts: 67

PostPosted: Sat Mar 27, 2010 6:19 pm    Post subject: Reply with quote

Thanks.

Everthing works well now.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group