Sorting lines on colour (color for some)

Mike Bonner bonnmike at gmail.com
Thu Sep 18 23:37:07 EDT 2014


No time to test right now, but shouldn't it be possible to use the
styledtext array as part of the sort?  The data in the array is in the form
of..

myArray[tCounter]["runs"][1]["style"]["textColor"]

where tCounter is the line number (aka, paragraph number)

It can get complicated fast if lines have more than 1 "run", but maybe
something in there could be useful.  Just thinking off the top of my head,
grab the array, flatten it and tack on the text for each line, do the sort
on the colors, (though if there is a line with no color set, the array
entry for that line will be empty, but the array key for the paragraph does
exist, not sure how to handle an unset textcolor key yet), rebuild the
array, renumbering by paragraph based on the new line positions, then pop
the text back into the field, and set the styledtext to the new array.

Could be a royal pain, but a pain that works is better than a simple that
doesn't.

On Thu, Sep 18, 2014 at 3:46 PM, <dunbarx at aol.com> wrote:

>
> I thought the OP wanted colored text.  Anyway, the backColor does not sort
> either, using the same code.
>
>
> Jacque, why doesn't the thing sort?
>
>
> Craig
>
>
>
> -----Original Message-----
> From: J. Landman Gay <jacque at hyperactivesw.com>
> To: How to use LiveCode <use-livecode at lists.runrev.com>
> Sent: Thu, Sep 18, 2014 5:18 pm
> Subject: Re: Sorting lines on colour (color for some)
>
>
> On 9/18/2014, 3:06 PM, dunbarx at aol.com wrote:
> > Peter, you need foreground color, not backgroundColor.
> >
> >
> > So again, before I call Jacque, why does this not work?
>
> I think "backgroundColor" really is what you want. Lines can have their
> own backcolor, forecolor is the color of the text.
>
> --
> Jacqueline Landman Gay         |     jacque at hyperactivesw.com
> HyperActive Software           |     http://www.hyperactivesw.com
>
> _______________________________________________
> 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
>
>
>
> _______________________________________________
> 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