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
Trusted Contributor
Posts: 119
Registered: ‎04-29-2010
My Device: Curve 8520
My Carrier: TMN
Accepted Solution

strange behaviour

Hi,

 

I have a strange behaviour on the main screen of my app. 

My Screen looks like this:1ScreenClip.png

 

1, 2, 3, 4 and 5 are bitmap button's with navigation click extended.

I have a separate Thread to do some processing and this thread X is updating the contents of label A and label B.

Whenever thread X call function Y to update the labels the function Y executes label.setText(newtext) on both labels.

The stange behaviour:

When the thread x updates the labels text (via function Y) and the focus is on bitmap button 1,2,3 or 4 the text of the labels disappears and the screen looks like this:

2ScreenClip.png

 

 

If we turn the focus for bitmap button 5 or ListField the labels get updated correctly and the screen looks like this:

3ScreenClip.png

 

I've checked on debug that when the labels are updated that the text is not null.

Do you have some ideas on what is causing this?

Best Regards

 

 

 

................................................................................................
Tech On!
PTNews
more at On On On!
Developer
Posts: 16,992
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: strange behaviour

maybe a malfunction of your custom layout?
check the field in the debugger, does it contain the text? maybe it is just not displayed properly.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Trusted Contributor
Posts: 119
Registered: ‎04-29-2010
My Device: Curve 8520
My Carrier: TMN

Re: strange behaviour

"check the field in the debugger, does it contain the text? maybe it is just not displayed properly."

 

I've checked that the Label always contains some text.

 

"maybe a malfunction of your custom layout?"

 

Probably...but what custom layout ? HFMst? HTMtb? 

In that case shouldn't the picA and picB disappear also? In that case I supose the repaint on each update is made to the whole HFMst...

 

 

................................................................................................
Tech On!
PTNews
more at On On On!
Developer
Posts: 16,992
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: strange behaviour

you say that you overwrite the layout of the manager, i would look there first.
as a test, just add the fields to a standard manager without overriding any layout - it will look strange but you'll see if it works.
this will narrow down your search considerably.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Trusted Contributor
Posts: 119
Registered: ‎04-29-2010
My Device: Curve 8520
My Carrier: TMN

Re: strange behaviour

Ok, I will do that test simon.

Meanwhile are you able to explain how can the focus on buttons affect the relative position of the labels ?

 

................................................................................................
Tech On!
PTNews
more at On On On!
Highlighted
Developer
Posts: 2,268
Registered: ‎07-08-2009
My Device: various
My Carrier: various

Re: strange behaviour


jppedroso wrote:

Meanwhile are you able to explain how can the focus on buttons affect the relative position of the labels ?

 


A myriad of reasons: one of the possible examples would be if you set borders around your buttons and those borders change on focus. When they change, the whole screen will re-layout unless those borders were added with updateLayout set to false.

I'm giving this example just to show how a small thing somewhere on the screen can affect anything anywhere.

 

Now back to your original question: if those labels are indeed the instances of LabelField, their setText causes them to update layout (which, again, re-layouts the whole screen). This will invoke your custom sublayout, of course. If it relies on some values set in the same piece of code as setText it might pick up the wrong ones.

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Trusted Contributor
Posts: 119
Registered: ‎04-29-2010
My Device: Curve 8520
My Carrier: TMN

Re: strange behaviour

Hi,

 

I've found the solution for the strange behaviour. I added a "HFMst.ivalidate();" on function Y and that fixed the strange behaviour.

 

Thks simon_hain and arkadyz for your help.

 

................................................................................................
Tech On!
PTNews
more at On On On!