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
Falsetto
Posts: 15
Registered: ‎12-01-2012
My Device: Z10

Coloured square

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

Developer
Zmey
Posts: 1,512
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC

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
Brennan12325
Posts: 205
Registered: ‎05-15-2012
My Device: None

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!