Description: TableView, Dynamic Resizing of Columns proportionally
When a Form is Resized and the TableView needs to Resize this method adjusts
the Columns proportionally to their original sizes.
Columns can be set up this way:
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
The TableView Resize can be set up this way to obtain Resizing.
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
Example program attached with detailed comments.
Tags: TableView, Column Resize
			
			When a Form is Resized and the TableView needs to Resize this method adjusts
the Columns proportionally to their original sizes.
Columns can be set up this way:
			
				B4X:
			
		
		
		' Create TableView
Private Sub CreateTableView
    Dim RList As List
   
    RList.Initialize
    RList.Add("Venue")
    RList.Add("Code")
    RList.Add("RNO")
    RList.Add("Aband")
    RList.Add("Going")
    RList.Add("Dist.")
    RList.Add("Time")
    RList.Add("Status")
   
    MyTV.SetColumns(RList)
   
    ' Add column widths up to obtain total width alloted = 566
    MyTV.SetColumnWidth(0,140.0)    ' Venue    (Formula: 140 / 566 * 100 = 24.73498)
    MyTV.SetColumnWidth(1, 50.0)    ' Code
    MyTV.SetColumnWidth(2, 40.0)    ' RNO
    MyTV.SetColumnWidth(3, 60.0)    ' Aband
    MyTV.SetColumnWidth(4, 55.0)    ' Going
    MyTV.SetColumnWidth(5, 60.0)    ' Distance
    MyTV.SetColumnWidth(6, 81.0)    ' Time
    MyTV.SetColumnWidth(7, 80.0)    ' Status
   
    ' Do not want sorting on Columns
    For i= 0 To 7
        MyTV.SetColumnSortable(i, False)
    Next
   
    RList.Clear
End SubThe TableView Resize can be set up this way to obtain Resizing.
			
				B4X:
			
		
		
		' Resize TableView
' Take Vertical Scroll width off Width and divide remainder by 100%
' being the total width of the Columns
Sub MyTV_Resize (Width As Double, Height As Double)
    Dim wd As Double
'    Log(Width)
    ' Adjust = 4, scroll = 14
    wd = (Width - 18) / 100.00
    ' Work Percentage Column Width
    MyTV.SetColumnWidth(0, wd * 24.73498)    ' Venue  (24.73498)
    MyTV.SetColumnWidth(1, wd *  8.83392)    ' Code
    MyTV.SetColumnWidth(2, wd *  7.06713)    ' RNO
    MyTV.SetColumnWidth(3, wd * 10.60070)    ' Aband
    MyTV.SetColumnWidth(4, wd *  9.71731)    ' Going
    MyTV.SetColumnWidth(5, wd * 10.60070)    ' Distance
    MyTV.SetColumnWidth(6, wd * 14.31095)    ' Time
    MyTV.SetColumnWidth(7, wd * 14.13427)    ' Status
    ' Percentages total to approx. 100.00
End SubExample program attached with detailed comments.
Tags: TableView, Column Resize
 
				 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		