Setting hidden of lines very slow
Kaveh Bazargan
kaveh at rivervalleytechnologies.com
Fri Nov 30 11:15:15 EST 2018
Did not know about textStyle which has opened a whole new world! Thank you
so much for ruining my weekend Trevor. ;-)
hh, I love the first solution, which shows the beauty of LiveCode. But the
speed is the same as before...
i will try htmltext too. A while since I worked with it.
Thanks again.
On Fri, 30 Nov 2018 at 15:33, hh via use-livecode <
use-livecode at lists.runrev.com> wrote:
> If showing *only* lines with colored text means that all others
> are hidden then you could use:
>
> ...
> set hidden of line i of fld "text" to \
> (the textcolor of line i of fld "text" is empty)
> ...
>
> Trevor's script would then read:
> ...
> put (tTextA[i]["runs"][1]["style"]["textcolor"] is empty) \
> into tTextA[i]["style"]["hidden"]
> ...
>
> Here yet another fast method:
>
> on mouseUp
> put the millisecs into m1
> lock screen; lock messages
> put the htmltext of fld 1 into ht
> set linedelimiter to "<p"
> put the htmltext of fld 1 into ht
> replace " hidden" with empty in ht
> repeat for each line L in ht
> if offset("color=",L)>0 then put "<p" & L after s
> else put "<p hidden" & L after s
> end repeat
> set htmltext of fld 1 to s
> put the millisecs-m1 into fld "timing"
> end mouseUp
>
>
> > > Kaveh wrote:
> > > But here is a follow-up: Now I want to hide all lines that
> > > have no text style and only show lines with colored text.
> > > I use:
> > >
> > > repeat with i = 1 to the number of lines of fld 1
> > > if the textcolor of line i of fld "text" is not empty then
> > > set the hidden of line i of fld "text" to false
> > > end if
> > > end repeat
> > >
> > > This is taking time too. Any suggestions how to speed this up?
> > >
> >
> > Trevor wrote:
> > Try working with the styledText property.
> >
> > put the styledText of field "text" into tTextA
> >
> > # loop through paragraphs
> > repeat with i = 1 to the number of elements of tTextA
> > # Check if first run has textcolor set
> > if tTextA[i]["runs"][1]["style"]["textcolor"] is not empty then
> > # hide paragraph
> > put true into tTextA[i]["style"]["hidden"]
> > end if
> > end repeat
> >
> > set the styledText of fld "text" to tTextA
>
> _______________________________________________
> 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/>
More information about the use-livecode
mailing list