Wish CustomListView.AddTextClr

Mahares

Expert
Licensed User
Longtime User
CLV.AddTextItemClr(Text As Object, Value As Object, Clr As Int)
where Clr is the text color, of course.
Why would you need a new methos when you can simply do it this way:
B4X:
For i=0 To MyList.Size -1
        clv1.AddTextItem(MyList.Get(i), MyList.Get(i))
        Dim p As B4XView = clv1.GetPanel(i)  
        p.GetView(0).TextColor=xui.Color_Blue
    Next
 

LucaMs

Expert
Licensed User
Longtime User
Why would you need a new methos when you can...
The reason was Erel's explanation for preferring xCLV to ListView.
A member said that it is convenient to use ListView and Erel rightly said that, in addition to the limitations of ListView, using xCLV.AddText is the same as using ListView.
Having a method that allows you to directly choose the color of the text added in that simple way would be another advantage.

B4X:
'Mahares' code:
For i=0 To MyList.Size -1
    clv1.AddTextItem(MyList.Get(i), MyList.Get(i))
    Dim p As B4XView = clv1.GetPanel(i)
    p.GetView(0).TextColor=xui.Color_Blue
Next



For i=0 To MyList.Size -1
    clv1.AddTextItemClr(MyList.Get(i), MyList.Get(i), Xui.ColorBlue)
Next
'(or using a list of colors or alternating colors).
 
Last edited:

LucaMs

Expert
Licensed User
Longtime User
What is wrong in setting it up in the Designer. It works. textcolor
All of this was because a user was wondering why ListView is considered obsolete - not recommended.

With Listview you don't need to create items in the Designer, just add texts. You can do the same with xCustomListView; but if I also had the possibility to color the text it would be better.

I don't care at all, because I don't use ListView anymore and when I use xCLV I ALWAYS create items using the Designer.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…