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

Java Development

Reply
Developer
Posts: 558
Registered: ‎11-25-2008
My Device: Not Specified

Re: How to put Image on Buttonfield?

I don't see why you couldn't use a ButtonField and override drawFocus and onUnFocus or whatever those functions are to draw a bitmap or something in there.

 

Likewise, you could use the Custom one.

 

Again, the BitmapField works good too, but I prefer to use that as a canvas type Field.

 

I haven't really thought about this one. I just assumed that you could put an image in a ButtonField.

 

I'll have to look at this more closely tomorrow as I need to do this too (just haven't gotten there yet).

 

Thx

-D

New Developer
Posts: 8
Registered: ‎04-02-2009
My Device: Not Specified

Re: How to put Image on Buttonfield?

Yeah, I had a look at it. But even in the sample app, the click on the Picture Button works but the event also fires when I click outside the button!!! How can I fix that???

Try clicking on the button first, an then outside the button! Thats strange!

New Developer
Posts: 9
Registered: ‎04-04-2009
My Device: Not Specified

Re: How to put Image on Buttonfield?

if you're just clicking the screen again after having clicked your imagebutton once, the focus is still on the bitmapfield and so that focused element is what gets triggered by the click.  you'll notice that if you use the touchscreen to set focus on some other element, then click, it won't trigger again.

 

so here's what i do: in my navigationClick() override method, the last thing i do is just call setFocus() on some other element (such as my editfield) so that any button clicks won't actually trigger anything.

Developer
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: How to put Image on Buttonfield?

"Try clicking on the button first, an then outside the button!" Outside the button means, do you have any other Fields in the screen.

It works for me as expected. You can try giving the style as ButtonField.Consume_Click.


Use Search. "Accept Solution" If the problem is resolved.
Developer
Posts: 1,477
Registered: ‎12-30-2008
My Device: Torch 9810

Re: How to put Image on Buttonfield?

It seems you have some other fields also.. In the listener, check a condition on which component has raised the event..

 

Thanks! 

--
Manimaran Selvan
Co-Founder, Tech Lead,
Equity Markets Research Group
New Contributor
Posts: 6
Registered: ‎03-31-2014
My Device: 9900
My Carrier: Blackberry

Re: How to put Image on Buttonfield?

Hi I have a problem to add image with text in button field using java. It is possible to do using c++.

Please can any one help me.

Here is c++ plus QML link : https://developer.blackberry.com/native/reference/cascades/bb__cascades__button.html

I want to do the same using java.

 

Thanks

Highlighted
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: How to put Image on Buttonfield?

[ Edited ]

Welcome to the forums.

 

I think Mark has already answered your question, in this post:

 

http://supportforums.blackberry.com/t5/Java-Development/How-to-put-Image-on-Buttonfield/m-p/21787#M6...