B4A Library [Class] Flexible Table

eliasavila

New Member
Licensed User
Longtime User


How can I get this library?
 

nicodh

Member
Licensed User
Longtime User
Hello, I'm trying to use this class on my project, but it seems i can't (probably my fault) add rows on the table.
header is filled as it should but using addrow has no effect.
PIDtable.SetHeader(Array As String(" ","P", "I", "D"))
PIDtable.AddRow(Array As String( "Roll, "0","0","0"))

the second line does not appear on my view.

I'm doing something wrong?
 

nicodh

Member
Licensed User
Longtime User
Ok, i managed to do the table as i wanted.

I have a new question (and maybe a new feature if someone else is interested).

What about having the posibility of enabling or disabling the click posibility on all the cells?

When i click a cell i don't want the other cells to be clickable (i do a custom dialog that does some stuff on top of the table). Is there an easy way to set the cells to disable? and re enable them when i close my dialog?

Thanks.
 

klaus

Expert
Licensed User
Longtime User
Sorry for answering only today, but yesterday I was not at home almost the whole day.
I'm glad that you solved the problem.

To disable the cell click you can use a transparent or semi-transparent Panel covering the whole sceen and a Panel1_Click event with nothing in to 'consume' the click event.
 

Espinosa4

Active Member
Licensed User
Longtime User
Good morning,

I have a doubt. How can I to go to the last row after load the table?

B4X:
Dim inum as int
inum = 0
For i = 0 to cursor.rowcount -1
inum = inum + 1
....
next

Table.JumpToRow(inum-1)

But finally, after load the table goes to the first register.
 

Espinosa4

Active Member
Licensed User
Longtime User
Hi Klaus,
I made a mistake. I have a code line in resume process which change the result and I've just saw this now.

Sorry.
Best regards
Espinosa
 

metzeller_2013

Member
Licensed User
Longtime User
Good Day sir
Is it possible to populate the scroll view using the table.addrow function?... When i try to do this no data was being displayed on the scroll view only the headers are showing up. But when i load a csv file, data is being displayed and when i initiate the add row function it works as expected. But invoking the add row command when the scroll view is empty nothing is being displayed.
 

RauchG

Active Member
Licensed User
Longtime User
Hi Klaus,

can you please give me some food for thought, how can I separate the horizontal and vertical scrolling. For large tables, this is clearer.

greeting
Rh
 

klaus

Expert
Licensed User
Longtime User
Well, probably not that easy.
I think you'll need to modify the SV_ScrollChanged routine in the Table class.
Memorize the X and Y scroll positions, detect if PosX > PosY defining the direction and set either PosX or PosY to the position of the beginning of the scrolling.
Add a routine for the ScrollingIsFinished event where you should update the new X and Y positions.
 

ilan

Expert
Licensed User
Longtime User
hi klaus very nice class!

i have a little question

i am using the tableview in my app only to fill data and the read/edit from it to my controls (clv)
i am not showing the tableview only use it to fill data to it

i am using it because its very easy to use and i can sort it

the problem is that i have only about 150 entries and it takes a little bit until the tabelview loads the data and put it in the clv
is it possible to make the tableview faster?
 

klaus

Expert
Licensed User
Longtime User
The original class was written by Erel, I only added some improvements like some others.
I don't understand why you use the TableView class to just memorize data, there are for sure more efficient means to store the data.
Where do your data come from ?
What does take most time, the reading or the filling ?
 

ilan

Expert
Licensed User
Longtime User
there are for sure more efficient means to store the data

i dont know any other ways to read/edit/sort data like with the tableview
i would like to use sql but this is to difficult for me to understand

the tableview is very easy to use

Where do your data come from ?

i load my data from a csv file:
B4X:
Table1.LoadTableFromCSV(File.DirInternal,  userid &  "allshifts.csv",True)

What does take most time, the reading or the filling ?

i will check and tell, thank you for your help
 

ilan

Expert
Licensed User
Longtime User
i dont know how to check it

i put this before the code start

B4X:
Log("table2: " & DateTime.Time(DateTime.Now))

and after the code ends

and i get this:

start: table1: 22:18:39

end: table2: 22:18:40

so about a second
 

klaus

Expert
Licensed User
Longtime User
i would like to use sql but this is to difficult for me to understand
You should consider using SQLite !
Of course you need to learn at least the basics, but it's really not difficult.
Have a look at the link in my signature there you find two simple examples.
You should also have a look at the SQLite chapter in the User's Guide.

When you want to measure time in a program you should use a variable like.
B4X:
Dim t0 as Long
t0 = DateTime.Now
'
'
Log(DateTime.Now - t0)
That way you get the time difference in milliseconds.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…