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
raju504
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
Please use plain text.
BlackBerry Development Advisor
jomurray
Posts: 118
Registered: ‎09-06-2010
My Device: Z30
My Carrier: Vodafone UK

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 :-)

---------------------------------------
Please refrain from posting new questions in solved threads.
Feel free to press the like button on the right side if you liked my attempts to help :-)
And please mark posts as solved if you think I found the solution or set you on its path. Thanks!
Found a bug? Report it here
Follow me on Twitter @jcmrim
Please use plain text.
New Contributor
jboylan
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
  }

}

 

Please use plain text.