Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
New Developer
uziwuzzy
Posts: 5
Registered: ‎10-08-2013
My Carrier: developer
Accepted Solution

font size doesn't work

Hi guys,

I'm new to cascades.

I'm trying to change the text font size by typing  codes  directly and qml properties, but none of them works.

 

here's the code:

Label {
                text: "Hello"
                textStyle.fontSizeValue: 60.0

            }

 

I'm using OSX mountain lion to code, i'm worried if that's the problem.

 

Please use plain text.
Developer
BBSJdev
Posts: 4,930
Registered: ‎07-05-2012
My Carrier: Orange

Re: font size doesn't work

[ Edited ]

This property must be used in combination with setFontSize.

setFontSize takes a enum value indicating how you will specify the size e.g. PercentageValue, PointValue, etc.

 

http://developer.blackberry.com/native/reference/cascades/bb__cascades__textstyle.html#function-font...

 


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Please use plain text.
Developer
BBSJdev
Posts: 4,930
Registered: ‎07-05-2012
My Carrier: Orange

Re: font size doesn't work

Label {
    text: "60 point font, it's large"
    textStyle.fontSize: FontSize.PointValue
    textStyle.fontSizeValue: 60
}

 


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Please use plain text.
New Developer
uziwuzzy
Posts: 5
Registered: ‎10-08-2013
My Carrier: developer

Re: font size doesn't work

okay thanks,

I haven't read much of the documentation. I just do drag and drop from the Components and use the QML properties to edit the setting. So the code was generated from them. I thought the UI can be done by simply doing that. Does anyone have problem from using QML properties too? Or it is better not to use them and go back to write code manually?

Please use plain text.
Developer
BBSJdev
Posts: 4,930
Registered: ‎07-05-2012
My Carrier: Orange

Re: font size doesn't work

I don't think you'll be able to do it blindly. Pre reading the control's documentation you are going to use will save a lot of head scratching for you later.

 

Doing a quick test Momentics's autocompletion and auto help for fontSize/fontSizeValue are not particularly helpful in this situation.


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Please use plain text.
Developer
slashkyle
Posts: 766
Registered: ‎10-16-2012
My Carrier: Telus

Re: font size doesn't work

there are a few other ways to do it, you can either set it to a predefined size, lg, xl, xxl etc or set it to a systemdefault of that font size which will allow for it to be adjusted if the system defaults are changed (leaves option to increase size for those who have a hard time seeing small text)

 

Label {
    text: "60 point font, it's large"
    textStyle.fontSize: FontSize.Large  //XLarge, XXLarge etc
}
Label {
    text: "60 point font, it's large"
    textStyle.fontSize: SystemDefaults.TextStyles.BigText //SmallText etc
Please use plain text.