Android Question To Erel question

Status
Not open for further replies.

Enthousiastic

Active Member
Licensed User
Dear Erel , on B4xTable-Flags I want to change the columns order and put flags column between id and name.Please tell me how i want to make a similar database with my books. MANY MANY THANKS !!!
 

DonManfred

Expert
Licensed User
This is a community forum. Don´t limit your question to a single member.

See the tutorial on how the columns are setup here. Do it the same way for your layout putting the Flags columns at the Position you want.

B4X:
' The order of this lines defines the Order in the Table.
' Add your Flags Comulm after the ID Column.

B4XTable1.AddColumn("US County", B4XTable1.COLUMN_TYPE_NUMBERS)
B4XTable1.AddColumn("Name", B4XTable1.COLUMN_TYPE_TEXT)
 

Enthousiastic

Active Member
Licensed User
Thank you for your advice and forgive my ignorence the B4XTable is a new issue for me . I change the column's order as you said and i put the flags column after id .I left the other code as it was .The only problem is that all id values now are zero . Any idea why ?
 

mangojack

Well-Known Member
Licensed User
I change the column's order as you said and i put the flags column after id .I left the other code as it was .
To help us solve your problem you will need to show us the code you used to do this. Copy some code and show it using Code Tags.

[Code]Paste your code here ..[/Code]
 

Enthousiastic

Active Member
Licensed User
The past code is ( ichanged in activity_create the order of columns .All the other code is untouched ):

Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("1")
B4XTable1.AddColumn("Id", B4XTable1.COLUMN_TYPE_NUMBERS).Width = 50dip
FlagsColumn = B4XTable1.AddColumn("Flags", B4XTable1.COLUMN_TYPE_TEXT)
FlagsColumn.Width = 60dip
FlagsColumn.Searchable = False
FlagsColumn.Sortable = False
B4XTable1.RowHeight = 60dip

B4XTable1.AddColumn("Name", B4XTable1.COLUMN_TYPE_TEXT)
B4XTable1.AddColumn("Alpha2", B4XTable1.COLUMN_TYPE_TEXT).Width = 80dip
B4XTable1.AddColumn("Alpha3", B4XTable1.COLUMN_TYPE_TEXT).Width = 80dip
Dim su As StringUtils
Dim headers As List
headers.Initialize
Dim data As List = su.LoadCSV2(File.DirAssets, "world.csv", ",", headers)
B4XTable1.SetData(AddEmptyColumnToData(data))
B4XTable1.MaximumRowsPerPage = 10
B4XTable1.BuildLayoutsCache(10)

For i = 1 To FlagsColumn.CellsLayouts.Size - 1
Dim pnl As B4XView = FlagsColumn.CellsLayouts.Get(i)
Dim iv As ImageView
iv.Initialize("")
pnl.AddView(iv, 5dip, 5dip, FlagsColumn.Width - 10dip, B4XTable1.RowHeight - 10dip)
Next
End Sub
 

Mahares

Well Known Member
Licensed User
B4xTable-Flags I want to change the columns order and put flags column between id and name
Here is what I did to get it to work the way you want:
1. I changed the csv file by inserting a blank row at the second position and saved it.
2. I changed some of the code.
3. I have attached a complete working project the way you want it with the ID as the first column, Flags as the second, name as third and so on.
4, It works, but I do not know if it is the way that Erel would do it or the best way, but it works. See attached project

By the way:
You should really use code tags as you were told (you have been a member since 2012). Please do not address your questions to only Erel. That is disrespectful to the rest of the forum members as if they do not exist. Also , your question title 'to Erel question' is a poor title because it cannot be used as a search string in the forum to help someone else. It needs to be descriptive.
 

Attachments

Enthousiastic

Active Member
Licensed User
THANKS A LOT !! I will follow your advices, I did not want to offend anyone in the forum members. In short, is there any link , about how to use code tags you mentioned ?
 

LucaMs

Expert
Licensed User
You should also change the title of this thread, not only because you should post your questions to all members, but mainly because "To Erel question" seems to be a little bit generic.

upload_2019-2-16_6-56-15.png
 
Status
Not open for further replies.
Top