DataGrid question...

Pi Digital sean at pidigital.co.uk
Mon Mar 30 05:08:24 EDT 2020


Hmm, but if you look back to Curry’s last post he claims regarding table fields, not data grids :

>> Working out which cell has been clicked: Sorry, that's not accurate either. Yes, we do have that! Also for a long time.

Curry is a very reliable and valued source of LC knowledge. So, have we all missed a clever and simple, non convoluted method of telling which cell in a scrollable, non editable table field has been clicked? Even if that cell is empty. Something as simple as:

put the dgIndex of the target into theIndexThatWasClickedOn
?

Sean Cole
Pi


> On 30 Mar 2020, at 07:32, J. Landman Gay via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> I can't write a test handler right now, but I'm thinking you might be able do something like this:
> 
> repeat for each item i in the tabstops of the field:
>  if the clickH > i and less than item i+1,
>  that's your column
> 
> The clickline gives you the row.
> 
>> On 3/29/20 11:04 PM, Terry Judd via use-livecode wrote:
>> This is rough but sort of works...
>> on selectionChanged
>>    set the itemDel to tab
>>    put word 2 of the selectedLine into tRow
>>    put word 2 of the selectedChunk into nChar
>>    put length(line 1 to tRow-1 of me) into tStart
>>    put char tStart+2 to nChar of me into tText
>>    put the number of items in tText into tCol
>>    put tRow&&tCol
>> end selectionChanged
> 
> 
> -- 
> Jacqueline Landman Gay         |    



More information about the use-livecode mailing list