Setting hidden of lines very slow

Geoff Canyon gcanyon at gmail.com
Fri Nov 30 14:27:55 EST 2018


Why do you need to simulate non-contiguous selections? Set the
listBehavior, multipleHilites, and noncontiguousHilites of the field to
true and then you can do things like:

set the hilitedLines of fld 1 to 1,3,5

But to your original question, you should use:

repeat for each line L in the htmlText of fld 1
  -- put some htmlText after a variable based on what L contains
end repeat
  -- set the htmlText of fld 1 to the new htmlText

Or if you know what you want to do and don't need to check the existing
textColor and hidden, just:

repeat for each line L in fld 1


Here's an example of what the htmlText looks like for a field where the
first line has a font color and the second line is hidden:

<p><font color="#00FF00">test</font></p>
<p hidden>this</p>
<p>thing</p>

So if you don't need to check the existing state your code would look
something like this:

put 0 into i -- if you need a line count
repeat for each line L in fld 1
 add 1 to i -- again, if you need a line count
 if <test that says you're coloring this line> then
  put "<p><font color=" & quote & "#00FF00" & quote & ">" & L & "</font></p>"
& cr after newHTML
else
   put "<p hidden>" & L & "</p>" & cr after newHTML
end if
end repeat
set the htmlText of fld 1 to newHTML

gc


On Fri, Nov 30, 2018 at 8:36 AM Kaveh Bazargan via use-livecode <
use-livecode at lists.runrev.com> wrote:

> I am simulating a non-contiguous selection of text with a "Find all" button
> that sets the style of all found items of text.
>
> Then I want to inspect those "selections" only but showing the paras that
> contain them and hiding all other lines. So I have a full view and a
> "compact" view that the user can choose by clicking a button
>
> On Fri, 30 Nov 2018 at 16:31, Glen Bojsza via use-livecode <
> use-livecode at lists.runrev.com> wrote:
>
> > I was wondering at what stage or how the lines get chosen to be hidden or
> > not?
> > _______________________________________________
> > 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
> >
>
>
> --
> Kaveh Bazargan
> Director
> River Valley Technologies <http://rivervalleytechnologies.com/> • Twitter
> <https://twitter.com/kaveh1000> • LinkedIn
> <https://www.linkedin.com/in/bazargankaveh/>
> _______________________________________________
> 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