simple label question

MarkoMylo

Member
Licensed User
Longtime User
in designer i created LABEL form with label1 name,
how to add text to label from program or how to change label text when pressing button.
tried everything but does not work

in globals
Dim Label1 As Label

in activity create
Label1.Initialize("")
Label1.TextSize= 30
Label1.text= "b4a"

text "b4a" doesnt appear
 

Mark Read

Well-Known Member
Licensed User
Longtime User
Could it be that you have forgotten to add the label to the activity?

B4X:
Activity.Addview(Label1, left, top, width, height)

Replace the position words with values eg, 0,0,100dip, 10dip

Okay?
Regards

Mark
 
Upvote 0

MarkoMylo

Member
Licensed User
Longtime User
Could it be that you have forgotten to add the label to the activity?

B4X:
Activity.Addview(Label1, left, top, width, height)

Replace the position words with values eg, 0,0,100dip, 10dip

Okay?
Regards

Mark

i m able to see label but no text
 
Upvote 0

Mark Read

Well-Known Member
Licensed User
Longtime User
Sorry I missed the first few words.

in designer i created LABEL form with label1 name,

and then

Label1.Initialize("")

If the layout is created in designer then you don't need this line!

Regards
Mark
 
Upvote 0

AndroIwe

Member
Licensed User
Longtime User
When i test this and i do not Initialize the Label the Output seems correct.

B4X:
Activity.LoadLayout("Label")
Label1.TextSize= 30
Label1.text= "b4a"
 
Upvote 0
Top