Sorting lines on colour (color for some)

dunbarx at aol.com dunbarx at aol.com
Thu Sep 18 16:06:40 EDT 2014


I made this more robust, though no more effective:



on mouseUp
      sort lines of fld 1 numeric by item 1 of the effective foregroundColor of each & item 2 of the effective foregroundColor of each & item 3 of the effective foregroundColor of each
end mouseUp


This so "0,255,255" does not sort the same as "255,0,255". And I tried using "effective", as per Phil and as shown, but still no.


Peter, you need foreground color, not backgroundColor.


So again, before I call Jacque, why does this not work? Maybe calling the sortKey as a function? That should not fix it, though it would look prettier.


Craig



-----Original Message-----
From: Thierry Douez <th.douez at gmail.com>
To: How to use LiveCode <use-livecode at lists.runrev.com>
Sent: Thu, Sep 18, 2014 3:56 pm
Subject: Re: Sorting lines on colour (color for some)


2014-09-18 20:26 GMT+02:00 Peter Haworth <pete at lcsql.com>:

> Like that better than mine - good use of htmltext and regex!

> Pete

Thanks Peter,

and for those having real headacke with regex, you can write
the function this way:

function getHtmlColors L
   if offset( "<p bgcolor=", L) < 1 then return "z"
   return char 12 to 18 of L -- the 6 hexa chars
end getHtmlColors


But I personaly find it extremely ugly :)

Regards,

Thierry


> On Thu, Sep 18, 2014 at 11:01 AM,
Thierry Douez <th.douez at gmail.com> wrote:
>
>> Another one with some regex flavor
>>
>> on mouseUp
>>    local t
>>    put the htmltext of fld 1 into t
>>    sort lines of t  by getHtmlColors( each)
>>    set  the htmltext of fld 1 to t
>> end mouseUp
>>
>> function getHtmlColors L
>>    if matchText( L, "<p bgcolor=.#([0-9A-F]{6}).>", v) then  return v
>>    return "z"
>> end getHtmlColors
>>
>> Thierry



------------------------------------------------
Thierry Douez - http://sunny-tdz.com
Maker of sunnYperl - sunnYmidi - sunnYmage

_______________________________________________
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