Removing table headers forces a scrollbar

Post your Gambas programming questions here.
Post Reply
seany
Posts: 32
Joined: Friday 6th December 2019 3:09pm

Removing table headers forces a scrollbar

Post by seany »

Consider the table given by

Code: Select all

tTable
Here is the definition :
  Dim tTable As New TableView(mainArea) As "Dyntable_root"
  Dim i, j As Integer
  Dim c As String
  
  Dim code As String = ""
  
  tTable.Columns.Count = 3
  tTable.Columns[0].Title = "SAMPLE"
  tTable.Columns[0].Width = tTable.Font.TextWidth(tTable.Columns[0].Title) + 10
  tTable.Columns[1].Text = "ID"
  tTable.Columns[1].Width = tTable.Font.TextWidth(tTable.Columns[1].Title) + 100
  tTable.Columns[2].Text = "DATA"
  tTable.Columns[2].Width = tTable.Font.TextWidth(tTable.Columns[2].Title) + 200
  tTable.Font = parentTable.Font
  
  tTable.Width = 200 'parentTable.Current.Width + 10 
  tTable.Height = 80 'parentTable.Current.Height - tTable.Top - 5 - 10
  
  tTable.Resizable = True
Now, later on we do this :
For cnt = 0 To tTable.Rows.Count - 1
    sumVals = sumVals + tTable.Rows[cnt].Height
  Next
  
  
  tTable.Height = sumVals + 2 + tTable.Columns.Height
This sets the eight to 49. I checked.

Even below that we set :
tTable.Header = GridView.None


Even now, the height is 49, I checked. There is only one row, with row Height = 21. We turn off the headers with
tTable.Header = GridView.None
Now finally we do :
 Dim sumVals As Integer = 0
  Dim cnt As Integer = 0
  
  
  For cnt = 0 To tTable.Rows.Count - 1
    Print "adding: ", sumVals, "for ", cnt
    sumVals = sumVals + tTable.Rows[cnt].Height
    Print cnt, sumVals
  Next
  
  Print "headres gone? ", tTable.Header   ' prints 0
  tTable.Height = sumVals + 2    'alternatively : tTable.Height  - tTable.Columns.Height 
  'tTable.Resize(tTable.Width, sumVals+2)  '<--- alternatively I am using this
  
The table had one row, and it had a height of 21. So this should make the table height = 21 + 2.

Indeed I can print that the table height is now 23, but it is adding a few scrollbars! It seems, within the borders, the scrollbar still allows for a total height of 49. So something is making the 49 a persistent height. Even if the outer borders, and printed message agree, that I have tables of height 23 - it seems that inside the table, despite a single row, and turning off the headers via the none option, something of height 49 is still there.

What is wrong? Thank you.
User avatar
cogier
Site Admin
Posts: 1125
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: Removing table headers forces a scrollbar

Post by cogier »

The scroll bars can be turned off.
GridView1.ScrollBar = GridView.None
The gridview is 'Padded', by default, with 2. You could turn that off as well.
GridView1.Padding = 0
But why do you need to be so accurate?
seany
Posts: 32
Joined: Friday 6th December 2019 3:09pm

Re: Removing table headers forces a scrollbar

Post by seany »

Because I have made an AI in python, to analyze mining data. I want to display the output of the data, as well as training data used for this in a tabular form, wherein a table cell can contain other tables. The random inclusion of table scrollbars are causing me to lose the view.

Thank you anyway
Post Reply