DataGrid question...

Alex Tweedly alex at tweedly.net
Mon Mar 30 06:49:07 EDT 2020


I don't know of a simple way to do it.

However, Bernd's modTableField does do it, and it uses regular fields, 
and it's open source - so I took a very quick look there.

It's not simple :-)

But there's a function 'gatherItemClickedInfo' that (with some 
modifications) might be the foundation of a general handler for you.

Alex.


On 30/03/2020 10:08, Pi Digital via use-livecode wrote:
> 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         |
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode



More information about the use-livecode mailing list