Ask Your Question
0

On-the-fly dialogs in LO Calc - text size on buttons?

asked 2020-09-17 16:19:04 +0100

UncleOilybag gravatar image

I am writing some On the fly dialogs - ie not using the graphical dialog editor - and have discovered by much reading and searching how to edit the TextColor of buttons, and BackgroundColor of the dialogs e.g.

oDialogModel= createUnoService( "com.sun.star.awt.UnoControlDialogModel" )
oDialogModel.BackgroundColor = RGB (0,0,255)

and

oButtonModel = oDialogModel.createInstance( "com.sun.star.awt.UnoControlButtonModel" ) oButtonModel.BackgroundColor = RGB(154,245,154 )
oButtonModel.TextColor=RGB(255,255,255)

  • but for the life of me I cannot discover a way to alter the size, or the font, of the text written on the buttons. My goal is to produce some buttons with fairly large text. (Bold, italic etc ) I'm sure it is relatively easy but I cannot find it.

Please could someone assist.

Real code examples would be very useful - thankyou

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
1

answered 2020-09-17 18:01:19 +0100

You need properties:

    FontHeight = 25
    FontWeight = 150
    FontSlant = 1

FontHeight: Size font

FontWeight: Bold

FontSlant: Italic

I used in real example:

def test_dialog():
    args = dict(
        Name = 'dialog',
        Title = 'Test',
        Width = 150,
        Height = 100,
    )
    dlg = app.create_dialog(args)

    args = dict(
        Type = 'Button',
        Name = 'cmd_close',
        Label = 'Cerrar',
        Width = 100,
        Height = 30,
        FontHeight = 25,
        FontWeight = 150,
        FontSlant = 1,
    )
    dlg.add_control(args)
    dlg.open()
    return
edit flag offensive delete link more

Comments

That's what I coudn't find! - Thank you so much. I feel as if I'm getting somewhere now. Much appreciated.

UncleOilybag gravatar imageUncleOilybag ( 2020-09-17 23:15:26 +0100 )edit

Please, mark like correct with ✓

mauricio gravatar imagemauricio ( 2020-09-18 00:11:57 +0100 )edit
0

answered 2020-09-18 17:14:28 +0100

UncleOilybag gravatar image

So thanks to Mauricio I added these lines to the ones in the question:-

oButtonModel.FontWeight = 150 '#### BOLD (100=normal, 150-Bold), 200 = Black -chunky

oButtonModel.FontHeight = 16 ' #### FONT SIZE

oButtonModel.FontName = "Comic Sans MS" '###### FONT used

and everything looked much better!

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2020-09-17 16:19:04 +0100

Seen: 41 times

Last updated: Sep 18 '20