Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4android > Basic4android Getting started & Tutorials
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Basic4android Getting started & Tutorials Android development starts here. Please do not post questions in this sub-forum.

Creating a table view based on ScrollView

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-17-2010, 10:24 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,689
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default Creating a table view based on ScrollView

You can use the code in this example to show data in tabular form.



The table is made of two main views. The header row is made of a panel with labels. The main cells component is made of a ScrollView with labels as the cells.

You can modify the code to change the table appearance.
Some of the settings can be changed in Sub Globals:
Code:
    'Table settings
HeaderColor = Colors.Gray
NumberOfColumns = 
4
RowHeight = 
30dip
TableColor = 
Colors.White
FontColor = 
Colors.Black
HeaderFontColor = 
Colors.White
FontSize = 
14
Adding data to the table:
Code:
    'add header
SetHeader(Array As String("Col1""Col2""Col3""Col4"))
'add rows
For i = 1 To 100
    AddRow(
Array As String(i, "Some text", i * 2"abc"))
Next
'set the value of a specific cell
SetCell(03"New value")
'get the value 
Log("Cell (1, 2) value = " & GetCell(12))
Table events:
Code:
Sub Cell_Click
    
Dim rc As RowCol
    
Dim l As Label
    l = 
Sender
    rc = l.Tag
    activity.Title = 
"Cell clicked: (" & rc.Row & "" & rc.Col & ")"
End Sub
Sub Header_Click
    
Dim l As Label
    
Dim col As Int
    l = 
Sender
    col = l.Tag
    Activity.Title = 
"Header clicked: " & col
End Sub
The code is not too complicated and you can further customize it as needed.

Files: TableExample.zip doesn't include CSV functionality, however it can be used with Basic4android trial version.
TableExample1.1.zip depends on StringUtils library.

TableExample - v1.2 which also shows the grid lines, made by klaus, is available here: http://www.basic4ppc.com/forum/basic...html#post43670
Attached Files
File Type: zip TableExample.zip (5.7 KB, 748 views)
File Type: zip TableExample1.1.zip (12.2 KB, 876 views)
Reply With Quote
  #2 (permalink)  
Old 12-20-2010, 09:57 AM
Basic4ppc Veteran
 
Join Date: May 2009
Posts: 206
Default Can not Clear Record in Table

This examples is fine but can not clear existing record when populating new record.pls advise
Reply With Quote
  #3 (permalink)  
Old 12-20-2010, 05:52 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,689
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

What do you mean with clearing existing record?
Reply With Quote
  #4 (permalink)  
Old 12-21-2010, 02:46 AM
Basic4ppc Veteran
 
Join Date: May 2009
Posts: 206
Default Creating a table view based on ScrollView

Should not append Record when populate another dataset,So we need to clear (Delete) existing record before poupulating new dataset.
Reply With Quote
  #5 (permalink)  
Old 12-21-2010, 05:56 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,689
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

Do you want to remove a single row or all rows?
To remove all rows you can use:
Code:
Sub ClearAll
    
For i = Table.NumberOfViews -1 To 0 step -1
        Table.RemoveViewAt(i)
    
Next
    Table.Height = 
0
End Sub
Reply With Quote
  #6 (permalink)  
Old 12-21-2010, 08:38 AM
Basic4ppc Veteran
 
Join Date: May 2009
Posts: 206
Default

Thanks for your quick replay
Reply With Quote
  #7 (permalink)  
Old 12-22-2010, 12:53 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,689
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

LoadCSV and SaveCSV added. This is included in TableExample1.1.zip in the first post.
This is done using the new StringUtils library.
Reply With Quote
  #8 (permalink)  
Old 12-23-2010, 03:18 AM
Basic4ppc Veteran
 
Join Date: May 2009
Posts: 206
Default Creating a table view based on ScrollView

I have seen the Tabular example using StringUtil library it works fine,if you update Gridline that will become an Grid like in Basic4PPC.so please try to update the Gridline method.Please revert back soon.
Reply With Quote
  #9 (permalink)  
Old 12-25-2010, 03:40 AM
Basic4ppc Veteran
 
Join Date: May 2009
Posts: 206
Default

still you have not updated gridline for tabluar view,pls update ASAP
Reply With Quote
  #10 (permalink)  
Old 12-25-2010, 03:36 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,689
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

I don't think that it will be added in the near future.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
ScrollView example Erel Basic4android Getting started & Tutorials 30 05-08-2012 08:38 PM
TCP/IP Based Network traffic (Like WinSock) TARQ Questions (Windows Mobile) 8 01-21-2011 02:37 AM
Turn based game Max Tillberg Basic4android Updates and Questions 1 01-19-2011 05:57 PM
Basic4PPC based on CE 4.1 ysut Questions (Windows Mobile) 3 08-08-2008 09:00 AM
out-of-memory-error based on timer after switching to V6 Frank Questions (Windows Mobile) 2 01-17-2008 03:26 PM


All times are GMT. The time now is 10:24 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0