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
Highlighted
New Developer
Posts: 18
Registered: ‎12-01-2012
My Device: Z10
My Carrier: Play

Coloured square

Hi, I'm wondering how make in the simplest way coloured square with colour set in RGB and contains onClicked option ?

Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: Coloured square

[ Edited ]

Hi,

Container {
  background: Color.create("#00ff00")
  onTouch: {
    if (event.isDown()) {
      // do something
    }
  }
}

 Untested, but should work.


Andrey Fidrya, @zmeyc on twitter
Developer
Posts: 206
Registered: ‎05-15-2012
My Device: None
My Carrier: Telus

Re: Coloured square

You will probably need to add a preferredWidth and preferredHeight to that container or I suspect it will render with no size.

----------------------
Check out my app, Alien Flow for reddit

And of course, like my post if you found it helpful or informative!