B4J Question Combobox with fonts loosing color when click on them.

tanush62

Member
I use following code
combo:
    For Each familyname As String In fx.GetAllFontFamilies
        Dim lbl2 As Label
        lbl2.Initialize("")
        lbl2.Font = fx.CreateFont(familyname, 18, False, False)
        lbl2.Text = familyname
        lbl2.TextColor = fx.Colors.Yellow ' seting the color of label
        '
        ComboBox2.Items.Add(lbl2)
    Next
   
    ....
   
Private Sub ComboBox2_SelectedIndexChanged(Index As Int, Value As Object)
    Dim tmlab As Label
    tmlab = Value
    Dim fname As String = tmlab.Font.FamilyName
    'tmlab.Font.
    tmlab.TextColor = fx.Colors.Yellow
    ComboBox2.Items.Set(Index, tmlab) ' i thought this wil solve the problem, but it doesn't
    Log("color: " & tmlab.TextColor) ' just check the color, seems right
    If chind = 2 Then
        xfont = fx.CreateFont(fname, fsize1, fbold1, fitalic1)
        Main.fir1.Font = xfont
        nfont1 = fname
    Else If chind =3 Then
        xfont = fx.CreateFont(fname, fsize2, fbold2, fitalic2)
        Main.fir2.Font = xfont
        nfont2 = fname
    End If
End Sub

When i Click on item on combo box it loose text color (or it's transparent). What i'm doing wrong?
 
Top