How do I hide a Table Column?

fdx12345

Active Member
Licensed User
Longtime User
I have created a table and panel in code.

The Table has 5 colums of which 4 are for the user. I have fixed widths for all columns resulting in full screen width using the first 4. I do not care if the 5th goes off screen or is seen on horzintal orientation. The problem is on protrait mode, the 5th column over-rides my fixed column widths and squeeshes everything to make room for the 5th column to be seen on the display. I need to prevent this from happening in the portrait mode. Possibly hidding the 5th column will prevent it from squeezed all 5 columns into the Portrait mode. I plan on fixing the view to just Portrait (no landscape view).
 

fdx12345

Active Member
Licensed User
Longtime User
Table Code

The Table is defined in the Creat Activity:

B4X:
Sub Globals

Dim MyPanel As Panel
Dim MyTable As Table

end sub

Activity_Create(FirstTime As Boolean)
MyPanel.Initialize("MyPanel")         
MyTable.Initialize(Me, "MyTable", 6)


Activity.AddView(MyPanel, 0, 230dip, 100%x, 60%y)
MyTable.AddToActivity(MyPanel, 0, 0, MyPanel.Width, MyPanel.Height)   
MyTable.SetHeader(Array As String("xxxx xxxx", "xxxxxx", "xxx", "xxx", "xxxxxxxx", "xxx     xxxxxx x", "xxxxx"))
MyTable.SetColumnsWidths(Array As Int(95dip, 70dip, 40dip, 70dip, 80dip, 80dip))

The I just use the Addrow to add a line of data from user input via a user input panel.

B4X:
MyTable.AddRow(Array As String("xxxxxx", "xxxxxx", "xx", "xxxxx", "xxxx", "xx"))

Now, how do I hide the last column or prevent it from squeezing the other columns?
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
One strange thing in your code:
In SetHeader you have 7 intems
and in SetColumnsWidths and in AddRow you have only 6 items ?

But to hide , for example, column 6 you could use:
MyTable.SetColumnsWidths(Array As Int(95dip, 70dip, 40dip, 70dip, 80dip, 0))

Best regards.
 
Upvote 0

fdx12345

Active Member
Licensed User
Longtime User
Items vs declaration

Yep, I have 7 items but the Table is from 0 to 6 which makes 7. Through me at first when I used 1-6 and discovered the first count was 0, not 1.

Thanks for the help
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…