| View previous topic :: View next topic |
| Author |
Message |
Dennis Jelavic Power User

Joined: 13 Nov 2008 Posts: 67
|
Posted: Wed Mar 24, 2010 10:44 pm Post subject: Prog. setting of font characteristics of Control on a Dialog |
|
|
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 |
|
 |
B Marcelly Super User

Joined: 12 May 2004 Posts: 1414 Location: France
|
Posted: Sat Mar 27, 2010 8:21 am Post subject: |
|
|
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 / OpenOffice.org 3.4.1 en-US + langpacks, MS-Windows XP Home SP3
This forum is unusable, use instead Apache OpenOffice forums |
|
| Back to top |
|
 |
Dennis Jelavic Power User

Joined: 13 Nov 2008 Posts: 67
|
Posted: Sat Mar 27, 2010 6:19 pm Post subject: |
|
|
Thanks.
Everthing works well now. |
|
| Back to top |
|
 |
|