Aloha Brian and Richard,

@ Brian "put styledText...into tTextA[snip]" looks excellent. It does it all on 

@ Richard

Again, we all appreciate the time you take to help us "understand the 

The list is only 2000 lines, on into a field from a sqlLite list of audio 

That all happens "quickly" on mobile. But we all know that the

repeat with x=1 to (the number lines of fld "audioList")

on a field itself is slow, but on desktop I usual do in RAM first (per Brians 

But on mobile it produce a 800 second "wait" with the user clicked the list, to 
"unhilite" a previous title/selection

Also with 9.0.1.RC2  I was getting a new message from Android (did not happen 
on earlier versions) Android is attempting fill in the field, and when I click 
I get an unusual message from the OS.

App is not responding
Do you want to

Close the app [OR]

This is new to 9.0.1 RC 2 for this screen/UX

So I had to admit that my code is admittedly not well optimized. I began look 
around. And saw my old

repeat with x=1 to (the number lines of fld "audioList")

Thinking that was causing the app to "not respond" while it was the setting the 
color of line of everyline.  Aha I thought, "That's is: I am iterate through 
each line in the field itself!"

then I posted my question to the list...

Meanwhile I created a local variable and now store the Current hilitedline. No 
more "going through the whole field"

And *still* I get the msg

App is not responding
Do you want to

Close the app [OR]

but now I can click "Wait" the dialog disappeared at the change of color works 
as expect and the player started on change of Audio right was. So where it  
mysterious dialog is coming from?

===== For the "architecture" discussion:

 Having to generate "setters and getters" of local variable is tedious, and 
sometimes would nice have a global method. I keep thinking my attempt to use 
"chains" of nested behavior in this case (had not done it before) look 
interesting, but sometimes I think one long behavior is better. Like the old 
"one stack script for everything" approach.

As it stands, if you do not want to use global (who does!), for one "module" / 
stack with 3-4 behaviors, that need one value (temporarily) there is no way to 
do it. The code become "tangled" because all 4 behaviors need to know about

local sSelectNum

and you start using "setters and getters"  all over the place

command setJournalFlag pFlag

        put pFlag into sJournalFlag

end setJournalFlag

function getJournalFlag

        return sJournalFlag

end getJournalFlag

Then if this is "child" behavior, in parent you have to issue a 
"getJournalFlag()" every time you need that value, and debugging gets "crazy" 
-- better to have in all in one behavior.


Now I'm back on "mysterious" Android dialog, I have no clue/way to debug that?

On 8/22/18 8:15 PM, Richard Gaskin via use-livecode wrote:

Sannyasin Brahmanathaswami wrote:

 > I have some big lists in mobile,

How big is "big"? 100 lines?  1,000?  1,000,000?

 > I sent the bkgndColor of certain
 > lines.
 > Then I want clear that,
 > How do we do this "for each line x"
 > which does not return the number of the line, but value
 > command setAudioListColors pLineNum,pColor  # pass "4,"0,0,0"
 > #slow!
 >       repeat with x=1 to (the number lines of fld "audioList")
 >           set the backgroundcolor of line pLineNum of fld "audioList"
to pColor
 >     end repeat
 > repeat for each line x in fld "audioList"
 > # need to get a line number and not its value
 >   set the backgroundcolor of line pLineNum of fld "audioList" to pColor
 > end repeat
 > end setAudioListColors

Your command takes a line number and a color, and applies that color to
that one line, yes?  If so, why loop at all?

As written, the code applies the color to the same line over and over
for the number of lines in the field.

Maybe pLineNum could contain a list of line numbers?

If so, iterate through it rather than through the field, since chances
are you're only setting the color of a subset of all lines in the field.
Locking the screen first will speed that up even more.

But faster still will likely be to follow Brian's guidance on
styledText.  With that you probably don't even want to lock the field,
since all the changes are done in a variable outside the field, and the
variable is set back into the field only once at the end.

But once we understand what's needed, the speed difference may not
matter much. Or it might. It depends on how big "big" is.

If you want to clear everything at once:

   set the backgroundColor of line 1 to -1 of fld "audioList" to empty

All this is just guessing, though.  I'm not really sure what this
handler should do.

  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web

use-livecode mailing list
Please visit this url to subscribe, unsubscribe and manage your subscription 

Reply via email to