>I am using a grid to display fields of a table.
>I want to give the user a multiple-line selection tool with teh mouse.
>The user clicks on lets say first row of the grid and releases the mouse over the 10th row. at this point I want to selected lines between 1 and 10.
>By select I mean to mark a field in the table as selected.
>
>I tried to use MouseUp Event of the text object in the column and to use GridHittest to get the relative row and relative column where the user released the mouse, but I always get 0 for these relative positions....But even if it's going to work I am not sure how I am going to find the positions in the source table....
>
>Do you have any suggestions?
>
>Thanks,
>Vali
Vali,
GridHitTest works. How do you code it ? MouseDown object (typically a control in grid.column) gets MouseUp also. ie :
LPARAMETERS nButton, nShift, nXCoord, nYCoord
store 0 to nWhere, nRelrow, nRelCol
with This.parent.parent
.GridHittest(nXCoord, nYCoord, @nWhere, @nRelRow, @nRelCol)
.tag = transform(nWhere)+transform(nRelRow)+transform(nRelCol)
endwith
LPARAMETERS nButton, nShift, nXCoord, nYCoord
store 0 to nWhere, nRelrow, nRelCol
with This.parent.parent
.GridHittest(nXCoord, nYCoord, @nWhere, @nRelRow, @nRelCol)
.tag = .tag+chr(13)+transform(nWhere)+transform(nRelRow)+transform(nRelCol)
messagebox(.Tag)
endwith
You could easily find out start and end rows with a little math. However you should control scrolling too.
Cetin