Removing table headers forces a scrollbar

Post

Posted
Rating:
#1 (In Topic #919)
Regular
seany is in the usergroup ‘Regular’
Consider the table given by

Code

tTable

Here is the definition :

Code (gambas)

  1.   Dim tTable As New TableView(mainArea) As "Dyntable_root"
  2.   Dim i, j As Integer
  3.  
  4.   Dim code As String = ""
  5.  
  6.   tTable.Columns.Count = 3
  7.   tTable.Columns[0].Title = "SAMPLE"
  8.   tTable.Columns[0].Width = tTable.Font.TextWidth(tTable.Columns[0].Title) + 10
  9.   tTable.Columns[1].Text = "ID"
  10.   tTable.Columns[1].Width = tTable.Font.TextWidth(tTable.Columns[1].Title) + 100
  11.   tTable.Columns[2].Text = "DATA"
  12.   tTable.Columns[2].Width = tTable.Font.TextWidth(tTable.Columns[2].Title) + 200
  13.   tTable.Font = parentTable.Font
  14.  
  15.   tTable.Width = 200 'parentTable.Current.Width + 10
  16.   tTable.Height = 80 'parentTable.Current.Height - tTable.Top - 5 - 10
  17.  
  18.   tTable.Resizable = True
  19.  

Now, later on we do this :

Code (gambas)

  1. For cnt = 0 To tTable.Rows.Count - 1
  2.     sumVals = sumVals + tTable.Rows[cnt].Height
  3.   Next
  4.  
  5.  
  6.   tTable.Height = sumVals + 2 + tTable.Columns.Height

This sets the eight to 49. I checked.

Even below that we set :

Code (gambas)

  1. tTable.Header = GridView.None
  2.  
 
Even now, the height is 49, I checked. There is only one row, with row Height = 21. We turn off the headers with

Code (gambas)

  1. tTable.Header = GridView.None

Now finally we do :

Code (gambas)

  1.  Dim sumVals As Integer = 0
  2.   Dim cnt As Integer = 0
  3.  
  4.  
  5.   For cnt = 0 To tTable.Rows.Count - 1
  6.     Print "adding: ", sumVals, "for ", cnt
  7.     sumVals = sumVals + tTable.Rows[cnt].Height
  8.     Print cnt, sumVals
  9.   Next
  10.  
  11.   Print "headres gone? ", tTable.Header   ' prints 0
  12.   tTable.Height = sumVals + 2    'alternatively : tTable.Height  - tTable.Columns.Height
  13.   'tTable.Resize(tTable.Width, sumVals+2)  '<--- alternatively I am using this
  14.  

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.
Online now: No Back to the top

Post

Posted
Rating:
#2
Avatar
Guru
cogier is in the usergroup ‘Guru’
The scroll bars can be turned off.

Code (gambas)

  1. GridView1.ScrollBar = GridView.None

The gridview is 'Padded', by default, with 2. You could turn that off as well.

Code (gambas)

  1. GridView1.Padding = 0

But why do you need to be so accurate?
Online now: No Back to the top

Post

Posted
Rating:
#3
Regular
seany is in the usergroup ‘Regular’
 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
Online now: No Back to the top
1 guest and 0 members have just viewed this.