Page 1 of 1

Accessing a cell via mouse

Posted: Wed Oct 21, 2009 11:09 pm
by basti
Hi!

I have a table and would like to show the text of selected cell in a separate text field. The selection is done via mouse: just click on the cell and show the text.

I thought that should be pretty easy because I already use accessing a whole row via mouse (e.g. with the following line):

user := table.accessRow(table.row).itemObject.User;)

...but how did it work for the cell? All the accessCell-methods are based on delivering row- and column-number but these are supposed to be generated after clicking on a particual cell.

Appreciate any help! Thanks!

Re: Accessing a cell via mouse

Posted: Thu Oct 22, 2009 7:28 am
by ghosttie
If table.row is working for you then table.column should as well:

Code: Select all

table.accessCell(table.row, table.column);
If table.row and table.column aren't set to the right values when the click even is raised, you can use the mouseDown or mouseUp event like this:

Code: Select all

vars iRow, iCol : Integer; begin if table.getCellFromPosition(x, y, iRow, iCol) then table.accessCell(iRow, iCol); endif; end;

Re: Accessing a cell via mouse

Posted: Thu Oct 22, 2009 1:26 pm
by basti
Perfect! Thanks!