Re: Set the backgroundcolor of all lines a field to null
@Richard re: Algo: It is a list of audio titles in a category on our web site. most of which the metadata in stored local my sqlLite. The audio and been posted since the last update to the app, is "Recent". It is stored in an local variable/array with all the metadata for each audio, but only the title shown in the field. This user clicks the line. The mouseup returns word two of the clickline ("1" or "49") to sSelectNum I then set the background color of that line to "hilite" it. The behavior(s) take the sSelectNum and the magic happen .. goes to the local variable, determine if is a audio book, song, chant, music, if is the metadata in local dBase, or if is has to get to an API on server if is recent etc.)..show the player and begins the audio. But then, if user change her mind; click another line; we have to shut down the previous operation ...stop the player, clear its url etc. and also unhilite the line. lockscreen set the backcolor of char 1 to - 1 of fld x to empty unlockscreen Looks ideal! On 8/23/18 9:10 AM, Richard Gaskin via use-livecode wrote: > 2000 lines is not much. I suspect any time spent is relating to needing > the redraw the field each time it's touched. Try locking the screen at > the top of the handler and see if that helps. > > Also, my question about the algo itself was unaddressed. If you can > describe what you want it to do I'm sure we can find an efficient solution. > > -- Richard Gaskin ___ 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
Re: Set the backgroundcolor of all lines a field to null
There's a lot in that, Brahmanathaswami. http://lists.runrev.com/pipermail/use-livecode/2018-August/249651.html 2000 lines is not much. I suspect any time spent is relating to needing the redraw the field each time it's touched. Try locking the screen at the top of the handler and see if that helps. Also, my question about the algo itself was unaddressed. If you can describe what you want it to do I'm sure we can find an efficient solution. -- Richard Gaskin Fourth World Systems Software Design and Development for the Desktop, Mobile, and the Web ambassa...@fourthworld.comhttp://www.FourthWorld.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
Re: Set the backgroundcolor of all lines a field to null
If you just want to clear the whole field (Richard suggested something similar): set the backcolor of char 1 to - 1 of fld x to empty After that you can hilite other lines if needed. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com On August 23, 2018 9:32:14 AM Sannyasin Brahmanathaswami via use-livecode wrote: Aloha Brian and Richard, @ Brian "put styledText...into tTextA[snip]" looks excellent. It does it all on ram! @ Richard Again, we all appreciate the time you take to help us "understand the architecture" The list is only 2000 lines, on into a field from a sqlLite list of audio file/Title. 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 solution) 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] Wait 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] Wait 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 bac
Re: Set the backgroundcolor of all lines a field to null
Aloha Brian and Richard, @ Brian "put styledText...into tTextA[snip]" looks excellent. It does it all on ram! @ Richard Again, we all appreciate the time you take to help us "understand the architecture" The list is only 2000 lines, on into a field from a sqlLite list of audio file/Title. 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 solution) 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] Wait 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] Wait 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 use-livecode@lists.runrev.com Please
RE: Set the backgroundcolor of all lines a field to null
What would be very convenient would be an "index" option for the repeat construct. I have to add this index counter all the time. Repeat for each line tLine in tLines index tIndex tIndex would start at 1 and increment by 1 for each iteration. Ralph DiMola IT Director Evergreen Information Services rdim...@evergreeninfo.net -Original Message- From: use-livecode [mailto:use-livecode-boun...@lists.runrev.com] On Behalf Of dunbarxx via use-livecode Sent: Thursday, August 23, 2018 9:46 AM To: use-revolut...@lists.runrev.com Cc: dunbarxx Subject: Re: Set the backgroundcolor of all lines a field to null We are all happy with the speedy "repeat for each..." construction. But there are times when the good ol' "repeat with..." construction, which manages a counting index internally, is just the right way to do things. The line number is at the ready with each iteration. Craig -- Sent from: http://runtime-revolution.278305.n4.nabble.com/Revolution-User-f278306.html ___ 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 ___ 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
Re: Set the backgroundcolor of all lines a field to null
We are all happy with the speedy "repeat for each..." construction. But there are times when the good ol' "repeat with..." construction, which manages a counting index internally, is just the right way to do things. The line number is at the ready with each iteration. Craig -- Sent from: http://runtime-revolution.278305.n4.nabble.com/Revolution-User-f278306.html ___ 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
Re: Set the backgroundcolor of all lines a field to null
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 ambassa...@fourthworld.comhttp://www.FourthWorld.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
Re: Set the backgroundcolor of all lines a field to null
Have you looked at the performance of using styledText? put the styledText of fld "audioList" into tTextA repeat for each key tKey in tTextA put pColor into tTextA[tKey]["style"]["backgroundcolor"] end repeat set the styledText of fld "audioList" to tTextA Thanks, Brian > ___ 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
Re: Set the backgroundcolor of all lines a field to null
On 08/22/2018 08:35 PM, Sannyasin Brahmanathaswami via use-livecode wrote: I have some big lists in mobile, I sent the bkgndColor of certain lines. Then I want clear that, How do we do this "for each line x" What I do: put 1 into tLineNumber repeat for each line x in fld "audioList" # need to get a line number and not its value set the backgroundcolor of line tLineNumber of fld "audioList" to pColor add 1 to tLineNumber end repeat end setAudioListColors -- Mark Wieder ahsoftw...@gmail.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