On 9/19/2014, 8:18 PM, dunb...@aol.com wrote:
OK, I get that. But then how would a function, something you in
particular are fond of, work?

In this case I wouldn't use any field access, it would be inefficient and slow for all but very short field contents. But if someone put a knife to my throat and said, "write a function or else," then I'd do it the same way Bernd did, only instead of counting lines in the styledText, I'd count lines in the field. It requires the engine to access the field repeatedly for every line and makes me wince:

local sCounter = 0

on mouseUp -- about to mangle Bernd's handler now
   put 0 into sCounter
   sort lines of field "fData" numeric ascending by myColor(each)
end mouseUp

function myColor
   add 1 to sCounter
   put the backcolor of line sCounter of fld "fData" into tRGB -- ow, ow

   if tRGB = "" then -- no backgroundColor
      return 0
   end if

   return item 1 of tRGB -- test for redness

   -- or do anything you want with R,G,B

end myColor

--
Jacqueline Landman Gay         |     jac...@hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to