Detecting which column was clicked in a Table field
Peter Brigham MD
pmbrig at gmail.com
Thu May 27 09:25:48 EDT 2010
I found that the best way to get a column number is to use item 1 of
the clickloc, subtract the left of the field to get the relative x-
value for the click in the field (you may have to also correct for the
borderwidth of the field)), then compare with the tabstops. This
always gives the accurate column number no matter whether you click on
white space or text.
-- Peter
Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig
On May 26, 2010, at 6:53 PM, J. Landman Gay wrote:
> Mark Stuart wrote:
>> on 5/26/2010, Jacqueline wrote:
>> Something like this:
>> put word 4 of the clickchunk into tCharNum
>> subtract (the number of chars in line 1 to \
>> (word 2 of the clickline)-1 of me) +1 from tCharNum
>> set the itemdel to tab
>> put the number of items in char 1 to tCharNum of the value of the
>> clickLine
>> <<
>> Hi,
>> I tried your script and it worked as is, but not as planned.
>> When clicking in the white space of a column, it returns the number
>> 4.
>> When clicking on the text of a column, a number is returned.
>> But when clicking in the far left column, it returns 0 (zero).
>
> That's technically correct because there aren't any items before the
> text starts. You could put in a single exception for that special
> case: if tNumber < 1 then put 1 into tNumber.
>
> --
> Jacqueline Landman Gay | jacque at hyperactivesw.com
> HyperActive Software | http://www.hyperactivesw.com
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list