Accessing a cell via mouse

Forums for specific tips, techniques and example code
basti
Posts: 13
Joined: Tue Oct 13, 2009 10:39 am

Accessing a cell via mouse

Postby basti » Wed Oct 21, 2009 11:09 pm

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!

User avatar
ghosttie
Posts: 181
Joined: Sat Aug 15, 2009 1:25 am
Location: Atlanta, GA, USA
Contact:

Re: Accessing a cell via mouse

Postby ghosttie » Thu Oct 22, 2009 7:28 am

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;
I have a catapult. Give me all the money or I will fling an enormous rock at your head.

basti
Posts: 13
Joined: Tue Oct 13, 2009 10:39 am

Re: Accessing a cell via mouse

Postby basti » Thu Oct 22, 2009 1:26 pm

Perfect! Thanks!


Return to “Tips and Techniques”

Who is online

Users browsing this forum: No registered users and 10 guests

cron