Problem with updating label.text

Spacewalker

Member
Licensed User
Longtime User
Hello,

I am using a label to display the current value of a seekbar.
I have add the label in the designer to a layout.

My problem it that after changing ".text" the display of "myLabel.text" is not correct.

It's a bit difficult to explain...but it looks as if 2 values are mixed in the display:
There is always a "3" visible in the background of myLabel.text and "over" this I see other numbers.

I have tried to use "invalidate" to force a redraw of the label but it didnt solve the problem

Here is what I do:

B4X:
in  Globals :
dim myLabel as label

in Activity_Create :
myLabel.text = "3"  ' set a default start value. This  is always displayed in the background

in mySeekbar__ValueChanged (value As Int, UserChanged As Boolean)

'myLabel.Text =""
'myLabel.Invalidate
myLabel.Text = value+5  'Values are updated in .text - but I see always a "3" in the background
'myLabel.Invalidate

I see the same problem when I use an editfield

Heinz
 
Last edited:

mc73

Well-Known Member
Licensed User
Longtime User
Strange. Can you post a screenshot? Also, if this happens with editText boxes as well, what is happening if you enter data to them? Still seeing a background text?
 
Upvote 0

Spacewalker

Member
Licensed User
Longtime User
I have attached an image showing .text of a label
It shows 2 numbers that are "mixed"
a "3" in the background and a "2"

If I use an editfield and edit the text manually then it is OK - but if I update the text programmatically then the numbers are "mixed

Heinz
 

Attachments

  • Image1.jpg
    Image1.jpg
    2 KB · Views: 271
Upvote 0

Spacewalker

Member
Licensed User
Longtime User
I have attached a demo that shows my probem.

Start the app and select a language
Then move the seekbar.
While moving the seekbar the values of a label and 2 editfields are updated

The problem is the update of the label (txtSize3).
This is done in the main module in :
sub seekSpielfeldgroesse_ValueChanged (value As Int, UserChanged As Boolean)

In the background I always see the default-value that I have put in activity_resume:
txtSize3.Text = "3" 'start value : whatever I put here - it will stay in the background when updating .text in seekSpielfeldgroesse_ValueChanged


The display of the two editfields update correctly - but I had to set .enabed=true
With .enabled=false I see similar problems as with the label (some shadows in the display)
But since I plan to use a label this is not real a problem.

I see this using B4A V.2.22 in the emulator and on a real device (using target platform Android 4.1.2)


Heinz
 

Attachments

  • LabelProblem.zip
    48.5 KB · Views: 229
  • LabelProblem2.png
    LabelProblem2.png
    39.2 KB · Views: 286
Upvote 0
Top