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

Posts: 139
Registered: ‎05-24-2011
My Device: Z30 running 10.2 and Playbook 4GLTE running OS2.1
My Carrier: rogers

setting an imageview image based on state of a c++ object?

hi gang!


i'm trying to set an image to an ImageView based on the state of a C++ object.  I've been trying to do this with javascript on a simple custom component - which is a LabelImageView - a label, with an ImageView.


LabelImageView {
                        id: liv1
                        label: "Active:"
                        image: "asset:///images/alert-off.png";
                        function isActive() {
                            var isTrue;
                            isTrue = cppObject.isActive;
                            if (isTrue == true) {
                                image = "asset:///images/alert-on.png";  
                            } else {
                                image = "asset:///images/alert-off.png";
                        onCreationCompleted: { 

 This works well enough on a component by component basis, but i'm not sure of the best way to do this for many components other than adding the function to each LabelImageView - and i have several places where i want to use this.


any ideas?





bron: a cron-like scheduler for BlackBerry 10