B4J Question Label textcolor not changing

tufanv

Expert
Licensed User
Longtime User
Hello,

I have a label added to scrollpane with this :

B4X:
                Dim p As Pane
                Dim sv As ScrollPane
                sv.Initialize("sv")
                p.Initialize("p")
       
                p = sv.InnerNode

lblexvolume(ist).Initialize("lblexv")
                    lblexvolume(ist).Alignment="CENTER_LEFT"
                    lblexvolume(ist).Font=fx.CreateFont("TrebuchetMS","14",False,False)
                   
                      lblexvolume(ist).Text="24H Vol: $ " & NumberFormat2(VOLUME24HOURTO ,1,2,0,True)
                    lblexvolume(ist).TextColor=fx.Colors.RGB(255,237,129)

p.AddNode(lblexvolume(ist),5,renkex(ist).top+30dip,240,28)

scrollexchange.InnerNode=p

It should change the textcolor but it is not , the color is always white. What am I missing here ?
TY
 

stevel05

Expert
Licensed User
Longtime User
It's difficult to tell without seeing the rest of the logic.

I did this as a quick test which works as expected.

B4X:
Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    Private ImageView1 As ImageView
    Private lblexVolume(10) As Label
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.RootPane.LoadLayout("1") 'Load the layout file.
    MainForm.Show
  
    Dim p As Pane
    Dim sv As ScrollPane
    sv.Initialize("sv")
    p.Initialize("p")
  
  
     
    p = sv.InnerNode
  
    Dim ist As Int = 0

    lblexVolume(ist).Initialize("lblexv")
    lblexVolume(ist).Alignment="CENTER_LEFT"
    lblexVolume(ist).Font=fx.CreateFont("TrebuchetMS","14",False,False)
                 
    lblexVolume(ist).Text="24H Vol: $ " & NumberFormat2(0.4 ,1,2,0,True)
    lblexVolume(ist).TextColor=fx.Colors.RGB(255,237,129)

    p.AddNode(lblexVolume(ist),5,30dip,240,28)

    MainForm.RootPane.AddNode(sv,0,0,MainForm.RootPane.PrefWidth,MainForm.RootPane.PrefHeight)

End Sub

'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
    Return True
End Sub

What is ScrollExchange ?
 
Upvote 0

tufanv

Expert
Licensed User
Longtime User
It's difficult to tell without seeing the rest of the logic.

I did this as a quick test which works as expected.

B4X:
Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    Private ImageView1 As ImageView
    Private lblexVolume(10) As Label
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.RootPane.LoadLayout("1") 'Load the layout file.
    MainForm.Show

    Dim p As Pane
    Dim sv As ScrollPane
    sv.Initialize("sv")
    p.Initialize("p")


   
    p = sv.InnerNode

    Dim ist As Int = 0

    lblexVolume(ist).Initialize("lblexv")
    lblexVolume(ist).Alignment="CENTER_LEFT"
    lblexVolume(ist).Font=fx.CreateFont("TrebuchetMS","14",False,False)
               
    lblexVolume(ist).Text="24H Vol: $ " & NumberFormat2(0.4 ,1,2,0,True)
    lblexVolume(ist).TextColor=fx.Colors.RGB(255,237,129)

    p.AddNode(lblexVolume(ist),5,30dip,240,28)

    MainForm.RootPane.AddNode(sv,0,0,MainForm.RootPane.PrefWidth,MainForm.RootPane.PrefHeight)

End Sub

'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
    Return True
End Sub

What is ScrollExchange ?

Thanks for answer.
scrollexchange is a scrollpane
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
The code as presented does not seem to do anything different, so I don't think I am able to offer any solutions.

Perhaps you could post a runnable example that shows the problem, it may then be possible to track down the issue.
 
Upvote 0
Top