Nothing is impossible for me! I'm kidding of course! I finded out a solution.
Dim Spinner_List_Value() As List
Dim Spinner_ListID As Int
For i = 0 To cursor1.RowCount - 1
cursor1.Position = i
' Set ID
Spinner_List_ID(0).add(cursor1.GetString2(0))
' Set String to view
Dim rs As RichString
rs.Initialize(cursor1.GetString2(1))
rs.Style(Typeface.STYLE_ITALIC,0, rs.Length)
Spinner_List_value(0).Add(rs)
Next
and then...
Dim S As Spinner
S.Initialize("spinner")
MyEditView.Panel.AddView(......)
S.AddAll(Spinner_List_Value(Spinner_ListID))
What would this look like if you were using mapping instead of SQL? I can't seem to adapt it properly:
Dim mapNation as Map
Dim strNation as String
Dim SpinnerListID() as Int
Dim SpinnerList() as List
'Nationality List
mapNation.Initialize
For i = 0 To 1
If i=0 Then strNation="United States of America"
If i=1 Then strNation="Great Britain"
'etc...
mapNation.Put(i, strNation)
Next
For i = 0 To mapNation.Size -1
'Set ID
SpinnerListID(i)=mapNation.GetKeyAt(i)
'Set string to view
Dim rs As RichString
rs.Initialize(mapNation.GetValueAt(i))
rs.Style(Typeface.STYLE_BOLD, 0, rs.Length)
SpinnerList(i).Add(rs)
Next
Please use [ code ] [ /code ] tags (without spaces) when posting code.
B4X:
For Each s As String in MapNation.Values
Dim rs As RichString
rs.Initialize(s)
rs.Style(Typeface.STYLE_BOLD, 0, rs.Length)
Spinner1.AddAll(Array As Object(rs))
Next
Alright, I've plugged this into the code and it still crashes. Perhaps it's because I'm trying to load a custom font into it?
B4X:
For Each s As String In mapNation.Values
Dim rs As RichString
rs.Initialize(s)
rs.Style(Typeface.LoadFromAssets("armalite.ttf"), 0, rs.Length)
spnNation.AddAll(Array As Object(rs))
Next
Thats not completely correct ........ In the code of DrownedBatI can see that he used the Style command - for setting the style - but with a TTF font (?)
He should use the Typeface command or better for custom fonts the TypefaceCustom command, i. e. :
B4X:
For Each s As String In qualList.Values
Private rs As RichString
rs.Initialize(s)
rs.BackColor(Colors.RGB(0, 100,255), 0, rs.Length)
rs.Color(Colors.White, 0, rs.Length)
rs.RelativeSize(tSize/14, 0, rs.Length)
rs.ScaleX(1, 0, rs.Length)
rs.Style(Typeface.STYLE_NORMAL, 0, rs.Length)
rs.TypefaceCustom(Typeface.LoadFromAssets("gothic.ttf"), 0, rs.Length)
spinner.AddAll(Array As Object(rs))
Next
****************************************************************************
U P D A T E:
Ok, I see now that Erel made some updates to this RS lib, which allows
now to handle custom fonts !