[Gambas-user] Request: TableView cell offset
ron
ronstk at ...239...
Tue Feb 10 11:24:59 CET 2004
Hallo Benoit,
I have a TableView with i.e 100 columns and 100 rows.
On screen there are only 10x10 visible and i scroll to the center.
I want to know the row/column in the top/left position.
Is it posible to have 2 properties
TableView.FirstColumn and TableView.FirstRow
for the first visible colum/row on the left/top side
or if I see the cell area as one big picture
TableView.ScrollX and TableView.ScrollY
for the top/left x/y position in this picture
Maybe both?
What must TableView.Scroll() do?
Is it the intention it must do the same as for ScrollView?
ScrollView_Scroll(ScrolX, ScrollY)
What I need is a posibility to get the actual column and row number
on the MouseDown and MouseMove events.
Using the mouse.x and .y works but the first row/column must be top/left
If I can get the scroll offsets I think it is perfect.
TableView.Row and .Column are only valid on Click event
During Mouse_Down, _Move and _Up the Row and Column are the old active cell
SUB hittest()
row=0
col=0
x=mouse.x ' x= relative to TBL object
x=x-offsetx 'row header caption width
X=X+TBL.ScrollX '<-------
y=mouse.y 'y=Relative to TBL object
y=y-offsety 'column header caption height
Y=Y-TBL.ScrollY '<-------
foreach column
w=w+width
if x>w inc col
next
foreach row
h=h+height
if y>h inc row
next
END
SUB TBL_MouseDown()
'here the .row / .column are the old cell
'get row/column with hittest()
'get current data (for drag?)
END
SUB TBL_MouseMove()
'here the .row / .column are the old cell
'get row/column with hittest()
if .row=downrow then
if docolor=true then set font color
if dodrop=true then drop data
endif
END
SUB TBL_MouseUp()
'here the .row / .column are the old cell
END
SUB TBL_MouseClick()
' here .row / .column are is the cell the up was done
if .row=downrow then
'put data
endif
END
Ron
More information about the User
mailing list