Colorizing line only works once?

Bob Sneidar bobsneidar at iotecdigital.com
Mon Feb 25 11:25:22 EST 2019


> On Feb 25, 2019, at 08:03 , Tom Glod via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
>   - dgline and dgindex are different, and as bob said, when the sort is
>   on, you have to work with dglines.

Yes, lines will reorder according to their visible order, indexes will maintain their values persistent through a sort. 

This is a mixed blessing. Let's say you get the dgHilitedLine of a datagrid, then wait for the user to do something with the data. In the interim the user resorts the datagrid! Now when you go to SET the dgHilitedLine, it's no longer the same data! 

I always use dgHilitedIndex for this reason. The only reason you need dgHilitedLine is when you MUST process the data in the visible order. For instance if I delete a row, and I want to automatically hilite the prior row, I need to use the dgHilitedLine -1. 

>   - remember to use the "of me" syntax with every change you make to the
>   controls of each row

As mentioned in another recent post, "of me" is necessary because each line of a datagrid has a set of controls for each row named the same as every other row. While this is allowed in Livecode (I never understood why) it means that referencing a specific copy of a control requires you also reference the row group it belongs to. I suspect these messages get sent to the row group specifically so that LC can reference the specific control for a given row. 

Bob S





More information about the Use-livecode mailing list