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
Posts: 86
Registered: ‎05-21-2012
My Device: Blackberry 10 Dev Alpha
My Carrier: IDEA

How to display a number in 7 segment display format..?

Hi!

 

     I need to show a label in seven segment display format. In 10.2 OS, I can do it by using fonts. But how can I do this in previous BB10 versions ? because fonts are not supported in them.

 

      And there is a QtWidget called QLCDNumber through which a number can be shown in seven segment display. But it is a QtGui class. How can I use it in cascades application...?

 

Thanks in advance..!

- Raju
Retired
Posts: 170
Registered: ‎09-06-2010
My Device: None
My Carrier: None

Re: How to display a number in 7 segment display format..?

I took a simplistic approach in this BlackBerry 10 NFC sample application and used a set of images

 

http://devblog.blackberry.com/2012/10/blackberry-10-app-nfc/

 

Maybe not applicable in your case but jus another option :-)

New Contributor
Posts: 7
Registered: ‎11-04-2013
My Device: Blackberry Q10
My Carrier: Verizon Wireless

Re: How to display a number in 7 segment display format..?

One thing to consider is using two images (horizontal bar, vertical bar) and make a "digit" Container.  Then it is a simple matter of changing the opacity of the image based on the number.  For example: 

 

Container {

 

  property int digit

  ImageView {
       id: topbar
       opacity: ( (digit==0 || digit==2 || digit ==3 || digit == 5 || digit == 6 || digit == 7 || digit == 8 || digit ==9) ? 1 : 0
  }

}