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
New Developer
Sultan14
Posts: 47
Registered: ‎05-11-2012
My Device: Blackberry Bold 9930
My Carrier: Tmobile

Labelfield Effect!

Hi,

I'm wondering if it's possible in blackberry to add effects to a specific labelfield? Effects like (fading, flashing..etc).

 

 

Thanks.

Please use plain text.
Developer
arkadyz
Posts: 2,268
Registered: ‎07-08-2009
My Device: various
My Carrier: various

Re: Labelfield Effect!

You'll have to implement a mechanism doing it - there is no "inherent" flashing or fading.

 

It is somewhat advanced programming, but if you want to do it, here are some pointers:

1) Override paint, which would manipulate the Graphics object passed into it before invoking super.paint(). This manipulation would be according to some internal flags, which tell it the state the field should be in.

2) Override onVisibilityChange, scheduling periodic updates when the field becomes visible and canceling those updates on visibility loss. One of the good ways is to use invokeLater with three parameters (third will be true - you want the updates to repeat). 

3) In those updates, set the desired flags and invalidate the field - this will invoke its paint with the new parameters.

 

Even though it sounds easy, it can easily go wrong. If you try to implement it and are stuck, do not hesitate to ask again.

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Please use plain text.
New Developer
Sultan14
Posts: 47
Registered: ‎05-11-2012
My Device: Blackberry Bold 9930
My Carrier: Tmobile

Re: Labelfield Effect!

Thanks arkadys,
It looks like it need a lot of work. I will try to work on it. And I'll let you know if I need anything.

Thank you again !
Please use plain text.
Developer
Developer
CMY
Posts: 1,123
Registered: ‎02-10-2009
My Device: 8130 / 8350 / 9530 / 9550 / 9850 / PlayBook
My Carrier: Verizon

Re: Labelfield Effect!

When you say fading do you mean a gradient fade or just making the field disappear gradually? To me the hardest part would be deciding when to invalidate the field. I've never tried it as all of my paint routines are custom, but unless the standard paint of the LabelField sets the alpha vale to 255 just set the visibility before you call super.paint and let it handle the rest.
Please use plain text.
New Developer
Sultan14
Posts: 47
Registered: ‎05-11-2012
My Device: Blackberry Bold 9930
My Carrier: Tmobile

Re: Labelfield Effect!

I was thinking about making the field shows up and disappear. Like flashing or something like that. 

I was hoping that there is a custom code that I can use, like that animation we use to jump from page 

to another. 

 

Thank you so much!

Please use plain text.