Multiple Tableview

junaidahmed

Well-Known Member
Licensed User
Longtime User
realy i am facing problem for multiple tableview in same activity,I need example code to solve my problem.Pls revert back soon
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Attached an example with two Tables.

Best regards.
 

Attachments

  • TableExample2.zip
    12.7 KB · Views: 1,333
  • TableExample20.jpg
    TableExample20.jpg
    41.8 KB · Views: 32,869
Upvote 0

timisusually

New Member
Licensed User
Longtime User
Has anyone had any luck with abstracting this control into something more re-usable? I'd like to move as much of the code as possible into a code module so that I don't have to redeclare on each activity. Any idea if this is possible??? I haven't had much luck yet.

Thanks in advance. This control is a great addition to B4A...
 
Upvote 0

okokur

New Member
Licensed User
Longtime User
hello,

my english is not good ... :-(

the example does not work with two different tables.
for one table you use too much code.
but for two different tables i use the same solution-way like you.

all functions exists two times like your code: i.e. getview1 and getview2

by using different tables you have to use different variables inside the functions too:

Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim StringUtils1 As StringUtils
Dim StringUtils2 As StringUtils
End Sub
....
Type RowCol (Row As Int, Col As Int)
Type RowCol2 (Row2 As Int, Col2 As Int)
....
Sub Cell_Click
Dim rc As RowCol
Dim l As Label
l = Sender
rc = l.Tag
SelectRow(rc.Row)
activity.Title = "Cell clicked: (" & rc.Row & ", " & rc.Col & ")"
End Sub
Sub Cell_Click2
Dim rc1 As RowCol2
Dim l1 As Label
l1 = Sender
rc1 = l1.Tag
SelectRow2(rc1.Row2)
activity.Title = "Cell clicked: (" & rc1.Row2 & ", " & rc1.Col2 & ")"
End Sub

for a useable example install oki.apk and copy the two *.csv files to the root of your sd-card. the app is my suggar-program for saving blood-sugar-thing and the insuling for giving it to my body. the results could save in table-one. the second table is a list of meals with many infos - only for read (at first).
i think, you know now what i mean about my "not good english".
(its for device with 480*800 display)

the solution is not very usable for more than 2 different tables. its too much ... ähm .. too easy for many many faults ...
 

Attachments

  • oki.zip
    151.8 KB · Views: 599
Last edited:
Upvote 0

klaus

Expert
Licensed User
Longtime User
the example does not work with two different tables.
What's the problem you had ?

for one table you use too much code
What code is too much ? The example is for two !

by using different tables you have to use different variables inside the functions too
This is not true!
B4X:
Type RowCol (Row As Int, Col As Int)
Type RowCol2 (Row2 As Int, Col2 As Int)
You declare two same types, why ?
The RowCol variables are local in the routines so no need to have different ones.

Best regards.
 
Upvote 0

b4AMarkO

Member
Licensed User
Longtime User
This is very nice indeed ...

Question: Can the Row colors be changed ... to something not so brite? :)

Crazy question I know ... but I need something like this that is darker to fit the rest of my apps theme

Also, I see you used a csv file but I am wanting to add to it item row by item row

I need to add a

Time Stamp | **** Title **** | Then NOTE/Description of event

I need to be able to Delete the row or insert a new row and so on
Also need to be able to edit any of the info in the row

So ... Can do Yes?
 
Upvote 0
Top