[Solved for now] How to get the height of the title of a tableview

Post

Posted
Rating:
#1 (In Topic #916)
Regular
seany is in the usergroup ‘Regular’
Please consider this snippet :

Code (gambas)

  1. TableView1.Columns.Count = 3
  2.   TableView1.Columns[0].Title = "Variable Class"
  3.   TableView1.Columns[0].Width = TableView1.Font.TextWidth(TableView1.Columns[0].Title) + 10
  4.   TableView1.Columns[1].Text = "ID"
  5.   TableView1.Columns[1].Width = TableView1.Font.TextWidth(TableView1.Columns[1].Title) + 100
  6.   TableView1.Columns[2].Text = "DATA"
  7.   TableView1.Columns[2].Width = TableView1.Font.TextWidth(TableView1.Columns[2].Title) + 200
  8.  

Now, I have clicked on a table cell. So the current row index is stored in TableView1.Row. I want to know, relative to the container, where the top of the current cell is. So all what I need to do is sum up the individual row heights upto but not including current cell / current row index, then add TableView1.Top. Now, if I do this :

Code (gambas)

  1. sumVals = 0
  2.   For cnt = 0 To TableView1.Row - 1
  3.     sumVals = sumVals + TableView1.Rows[cnt].Height
  4.   Next
  5. cellTop = TableView1.Top + sumVals + 2
  6.  

This however is not including the height of the title row. In the For loop definition, the 0 jumps to the first row after the title row ( = second overall) and starts counting from there.

I thought of using

Code (gambas)

  1. TableView1.Current.Top
as well. But in the first data row after the title row ( = second overall) it returns a value of 0, again ignoring the title height.

How can I address the problem, so that the height of the title row is counted? Thank you.
Online now: No Back to the top

Post

Posted
Rating:
#2
Guru
BruceSteers is in the usergroup ‘Guru’
 Maybe

 TableView1.Columns.Height
Online now: No Back to the top

Post

Posted
Rating:
#3
Regular
seany is in the usergroup ‘Regular’
That seems to work for now. Thank you
Online now: No Back to the top

Post

Posted
Rating:
#4
Guru
BruceSteers is in the usergroup ‘Guru’
i think it's the correct thing you asked for, the height of the header.

I probably should not have led with "Maybe" in the last post ;)

/comp/gb.qt4/_gridview_columns/height - Gambas Documentation
Online now: No Back to the top
1 guest and 0 members have just viewed this.