code is breaking LC 6.5.2-->LC 7.1 / colouring of a chunk
Posted: Sat Jan 16, 2016 11:29 am
Hi,
I have a short piece of code that works fine in LC 6.5.2. When moving to LC 7.1. or LC 8 DP13 the code breaks in a way that puzzles me:
The idea is that the user clicks on a line "selectline" in a longer text-field "alltext", the routine than takes a block of 3 lines (lines 1-3 or lines 4-6 or line 7-9 etc.) out of this longer text-field and places them in a field called "subtitles". Depending on which line the user had clicked, a part of the lines of the field "subtitles" should be coloured in red. e.g. if the user clicks on line 5 in field "alltext" the routine extracts line 4 to 6, places them in the field "subtitles" and colours the first line in field "subtitles" in red.
So now comes the mysterious part: In LC 6.5.2 this routine works without a problem. IN LC 7.1. this works sometimes, sometimes not. For example when I click line 6 the routine does what it is supposed to do, when I click in line 5, it doesn't. It gets even more mysterious (at least for me): If I click line 5 in field "alltext" the variable "lineshift" is calculated with 1. I checked it in various ways. If lineshift= 1 why then the following DOESN'T work:
but the following DOES work:
I spent the whole day to get my head around this; it most likely has to do something with the change in unicode treatment, still I cannot see the issue. How would I treat this piece of code in the 7.1 environment? Any help would be appreciated. I must say the upgrade from LC 6.5.2 to LC 7.1. has been bloody. So far my software has just get a lot worse and I would stay with 6.5.2. for now, but I need need to be able to use Thai language.
Best
Oliver
I have a short piece of code that works fine in LC 6.5.2. When moving to LC 7.1. or LC 8 DP13 the code breaks in a way that puzzles me:
Code: Select all
put ((trunc((selectline-1)/3)*3)+1) into blockstartline
put (((selectline-1)/3) - trunc((selectline-1)/3))*3 into lineshift
-- extracting and placing the next 3 lines of text in the subtitle field
put uniDecode(the unicodeText of line blockstartline to blockstartline+2 of field "alltext","UTF8") into linedecoded
set the unicodeText of fld "subtitles" to uniEncode(linedecoded,"UTF8")
set the foregroundcolor of line 0 to lineshift of field "subtitles" to "red"
-- set the foregroundcolor of line 0 to 1 of field "subtitles" to "red"
So now comes the mysterious part: In LC 6.5.2 this routine works without a problem. IN LC 7.1. this works sometimes, sometimes not. For example when I click line 6 the routine does what it is supposed to do, when I click in line 5, it doesn't. It gets even more mysterious (at least for me): If I click line 5 in field "alltext" the variable "lineshift" is calculated with 1. I checked it in various ways. If lineshift= 1 why then the following DOESN'T work:
Code: Select all
set the foregroundcolor of line 0 to lineshift of field "subtitles" to "red"
Code: Select all
set the foregroundcolor of line 0 to 1 of field "subtitles" to "red"
Best
Oliver