09-16-2011 08:12 AM
I have a strange behaviour on the main screen of my app.
My Screen looks like this:
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:
If we turn the focus for bitmap button 5 or ListField the labels get updated correctly and the screen looks like this:
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?
Solved! Go to Solution.
09-16-2011 08:24 AM
09-16-2011 08:34 AM
"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...
09-16-2011 08:37 AM
09-16-2011 01:24 PM
09-16-2011 03:59 PM
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.
09-17-2011 06:25 PM
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.