Feedback: comparing content of two fields
Michael Kann
mikekann at yahoo.com
Fri Apr 29 10:31:28 EDT 2011
One more gem from Jacqueline.
--- On Fri, 4/29/11, J. Landman Gay <jacque at hyperactivesw.com> wrote:
From: J. Landman Gay <jacque at hyperactivesw.com>
Subject: Re: Feedback: comparing content of two fields
To: "How to use LiveCode" <use-livecode at lists.runrev.com>
Date: Friday, April 29, 2011, 2:45 AM
On 4/28/11 10:04 PM, Ronald Zellner wrote:
> Had to remove the color change as you can't set that attribute- as Michael predicted.
Actually you can. Another thing that slows down a script is using a counter variable in a repeat loop. Sometimes you have to, but if possible use the "repeat for each" structure, which is much faster.
I didn't actually test this so you may need to adjust it, but this handler only hits the field to twice and avoids a counter. Using htmlText allows you to color the lines without accessing the field repeatedly. It should be fast enough that you don't need to have any visual progress indicators; using "repeat for each" can typically process thousands of lines in a few milliseconds.
on mouseUp
put fld "All" into allEntries
put fld "Rural" into ruralEntries
set the itemDelimiter to tab
repeat for each line tLine in allEntries
put tLine into tCurLine
if cr & (item 1 of tCurLine) & tab is in cr & ruralEntries then
put "Rural" into item 4 of tCurLine
put "<p><font color=#FF0000>" & tCurLine & "</font></p>" after tNewList
else
put "-" into item 4 of tCurLine
put "<p>" & tCurLine & "</p>" after tNewList
end if
end repeat
set the htmlText of fld "All" to tNewList
end mouseUp
-- 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
More information about the use-livecode
mailing list