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 Contributor
Posts: 3
Registered: ‎02-01-2013
My Device: 9900
My Carrier: Rogers
Accepted Solution

Chaning ImageButton image

Hi All,

 

I am trying to change the defaultimage on some ImageButtons at a point within my program, however it is not working for me.  I am sure its something simple that I have overlooked.

 

Right now I am doing the following:

 

ImageButton* myButton = ImageButton::create()
 .defaultImage(QUrl("asset:///images/oldButton.jpg"))
 .pressedImage(QUrl("asset:///images/oldButtonPressed.jpg"))
 .disabledImage(QUrl("asset:///images/oldButtonDisabled.jpg"));

....

...

...

 

myButton.defaultImageSourceChanged(QUrl("asset:///images/newButton.jpg"));
myButton.pressedImageSourceChanged(QUrl("asset:///images/newButtonPressed.jpg"));
myButton.disabledImageSourceChanged(QUrl("asset:///images/newButtonDisabled.jpg"));

 

I am doing this in C++ and I am likely doing something silly

 

Hopefully someone out there can point it out.

 

Thanks,

 

evsdev

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

Re: Chaning ImageButton image

defaultImageSourceChanged etc are signals which are emitted when property value changes.

 

You need to call setters: myButton->setDefaultImageSource(...) etc.

 

When using builders (create() method), setters do not have 'set' prefix.

 


Andrey Fidrya, @zmeyc on twitter