[Gambas-user] TableView PB's

ron ronstk at ...239...
Sun Feb 27 04:06:24 CET 2005


On Saturday 26 February 2005 23:40, Charlie Reinl wrote:
> Salut Benoit,
>
> need to know, on which Row/Column I have a mousedown or click event.
>
> Inside the TableView I have that with row,column.
>
> But whats about the columns-headers and rows-headers, get always the last
> row/column of the last pressed row/columns value from inside.
>
> what I wana do is, on mouse-down in a cell inside the TableView , I want to
> edit the celles value, that workes fine, with row,col I find the cells
> value .
>  a mouse-down on Columns-Header, should raise a searchbox to find the value
> given to the column where I clicked the header ?
> But the value given back after a header-mouse_down is wrong. As I said it
> gives back the last Value from inside the TV.
>
> Any hinds for that ?
>
> Amicalment
> Charlie
>

Use the RowAt() and ColAt() function.

xpos=mouse.x
if rowheader is visible then add/substract the width to it

ypos=mouse.y
if columnheader is visible add/substract the height of it

I'm unsure it was add/substract and can't look atm in the code
where I have used it.

RowAt(ypos) returns the actual rownumber in the table view and
ColAt(xpos) returns the column number
I had in a very long time ago the same problem and add this 2 functions
and they where acepted by benoit. :)

row=tbv.RowAt(ypos + (tbv.columnheader.visible * tbv.columnheader.height) )
.visible returns true/false and is -1 or 0 :)


Ron




More information about the User mailing list