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
Developer
bskania
Posts: 105
Registered: ‎04-24-2012
My Device: blackberry developer

Set some word of line as Bold in cascades (giving HTML styles)

Hello,

 

I want a label which contains multiline text.

But thanks to other guys who had also experience the same thing i.e label doesnot support multiline.

No my another problem is I want some word in that text with the different style.

 

example

 Hello "My name is bskania".

 

How can I set this?

I had used textarea to display text.

 

Thanks In advance.

bskania.

Please use plain text.
BlackBerry Development Advisor (Retired)
mgoulet
Posts: 329
Registered: ‎05-07-2012
My Device: BB Alpha

Re: Set some word of line as Bold in cascades (giving HTML styles)

Hi there,

You cannot currently bold words in a text field;

You could always use a WebView and control rich text using html5, which will give you the flexibility to customize text in any way you want;

 

Martin

Please use plain text.
Developer
kylefowler
Posts: 526
Registered: ‎05-17-2009
My Device: 9900

Re: Set some word of line as Bold in cascades (giving HTML styles)

We (the community) have a few feature requests in JIRA for a RichTextField type control so hopefully that gets done by the time it goes gold. WebView is way too heavy for 95% of use cases. Im not going to embed a webview in every list item.

Like all of my posts
Please use plain text.
Developer
bskania
Posts: 105
Registered: ‎04-24-2012
My Device: blackberry developer

Re: Set some word of line as Bold in cascades (giving HTML styles)

Hello.

 

Is it possible to use webview with another comonent on the same container.

Its occupy full height and width of container.

 

 

Please use plain text.
BlackBerry Development Advisor (Retired)
smacmartin
Posts: 499
Registered: ‎05-07-2012
My Device: developer

Re: Set some word of line as Bold in cascades (giving HTML styles)

Have you tried preferredHeight?

Have you tried StackLayoutProperties spaceQuota?

 

Stuart

Please use plain text.
Developer
helex
Posts: 291
Registered: ‎02-14-2012
My Device: Nokia N950 / BB Playbook

Re: Set some word of line as Bold in cascades (giving HTML styles)

Regarding the Release Notes there should be a RichTextField since the Beta 3, but I'm unable to find it anywhere in the documentation or the SDK.

 

Are here anyone able to see those new features?

Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: Set some word of line as Bold in cascades (giving HTML styles)

The docs haven't been updated, but try just using a few basic HTML elements such as <b> and <i> and you should see that they work for the moment. I believe you need to have the text wrapped with <html> and </html> but maybe not... and I haven't experimented with it yet myself. I'm just reporting what one of the guys in the #blackberrydev IRC channel on freenode.net reported to us.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
Developer
helex
Posts: 291
Registered: ‎02-14-2012
My Device: Nokia N950 / BB Playbook

Re: Set some word of line as Bold in cascades (giving HTML styles)


peter9477 wrote:
The docs haven't been updated, but try just using a few basic HTML elements such as <b> and <i> and you should see that they work for the moment. I believe you need to have the text wrapped with <html> and </html> but maybe not... and I haven't experimented with it yet myself. I'm just reporting what one of the guys in the #blackberrydev IRC channel on freenode.net reported to us.

Ah, I had to wrap my text into <html> </html> tags and it just works. Thanks! :smileyhappy:

Please use plain text.
Developer
gpatton
Posts: 193
Registered: ‎12-29-2010
My Device: Bold 9900

Re: Set some word of line as Bold in cascades (giving HTML styles)

Is there no way to combine html tags and property variants from JSONs?

 

I have a label as follows:

Label {
    text: "<html><b>blah</b></html>\n" + countryView.id
    multiline: true
}

 

The property variant in this case is countryView from a JSON list, and showing its "id".

What happens is that the html tags come verbatim, as in they're not applied. But the "\n" works and countryView.id goes to the next line.

 

 

Furthermore, is there any way to do this...where the "bold" applies on the property Variant itself?

 

Label {
text: "<html><b>countryView.id</b></html>\n" + countryView.name multiline: true }

 

Thanks.

Please use plain text.
Developer
kylefowler
Posts: 526
Registered: ‎05-17-2009
My Device: 9900

Re: Set some word of line as Bold in cascades (giving HTML styles)

Your whole string needs to be in html tags for it to work, you can mix and match.

 

Label {
    text: "<html><b>blah</b>\n" + countryView.id + "</html>"
    multiline: true
}

 

Label {
    text: "<html><b>" + countryView.id + "</b>\n" + countryView.name + "</html>"
    multiline: true
}

 

Like all of my posts
Please use plain text.