I was wondering if anyone has seen (and better yet, knows why) this kind of behavior might happen.
I have a custom property 'cpropTemplate' that I am putting directly into a field. When I counted the lines in a routine in the messagebox, they count correctly, but when I count them out in the field, there is a mysterious 'extra line' added.
I can correct this through code, i am just not sure why that would be necessary
Custom Property to field makes extra line?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: Custom Property to field makes extra line?
Try replacing before with after in your repeat loop and see if you get the correct results.
Andy Piddock
https://livecode1001.blogspot.com Built with LiveCode
https://github.com/AndyPiddock/TinyIDE Mini IDE alternative
https://github.com/AndyPiddock/Seth Editor color theming
http://livecodeshare.runrev.com/stack/897/ LiveCode-Multi-Search
https://livecode1001.blogspot.com Built with LiveCode
https://github.com/AndyPiddock/TinyIDE Mini IDE alternative
https://github.com/AndyPiddock/Seth Editor color theming
http://livecodeshare.runrev.com/stack/897/ LiveCode-Multi-Search
Re: Custom Property to field makes extra line?
I am afraid I must have explained the problem poorly Andy. I'll try again.
In the picture above, the list under "stkLines", I put those numbers in manually, only the text is in the custom property, which I'll post here -
The code I used to put it into the field is really direct, simply
*Edit, I just found out that executing this same line of code directly from the message box results in the field having the correct number of lines. Hmmm.
The code you see in the message box was just to see if I had extra lines in there somehow, and if that was causing the extra line in the field. The only place that code exists was in the message box.
Hopefully, that makes the question clearer, when I copy / paste the custom property contents, it comes out with the correct amount of lines, no issue.
The problem I'm trying to understand is why putting that same text directly into a field causes the text in line 13 to jump to line 14 of the field? And it is always that line, too, no other.
I thought I had originally inserted an extra cr or lf somehow, so I took all that data out and manually put it back in line by line, and I still get this same result. It is a curious issue to me, that is all.
*Edit - The code I used has only 1 other statement in front of it, which puts the cprop of the stack it is running from into a field as well. I wonder if that line is somehow affecting this one, though I can't see how. This is the handler up to the line in question -
*Edit 2 - I did also previously make sure that all lines terminated with LF, just in case -
In the picture above, the list under "stkLines", I put those numbers in manually, only the text is in the custom property, which I'll post here -
Code: Select all
[ Home Folder ]
[ Path to resFolder ]
[ Is image Magick installed ]
[ Path to exe ]
[ Path to icon ]
[ Path to converted icon ]
Code: Select all
put the cpropTemplate of stack "stkLines" into field 1 of card 1 of stack "stkLines"
The code you see in the message box was just to see if I had extra lines in there somehow, and if that was causing the extra line in the field. The only place that code exists was in the message box.
Hopefully, that makes the question clearer, when I copy / paste the custom property contents, it comes out with the correct amount of lines, no issue.
The problem I'm trying to understand is why putting that same text directly into a field causes the text in line 13 to jump to line 14 of the field? And it is always that line, too, no other.
I thought I had originally inserted an extra cr or lf somehow, so I took all that data out and manually put it back in line by line, and I still get this same result. It is a curious issue to me, that is all.
*Edit - The code I used has only 1 other statement in front of it, which puts the cprop of the stack it is running from into a field as well. I wonder if that line is somehow affecting this one, though I can't see how. This is the handler up to the line in question -
Code: Select all
on openStack
set the toolTipDelay to 10
// set the defaultFolder to the home folder
// put the template into field 1...
put the cpropTemplate of this stack into field 1 of this stack // stack this handler runs from
put the cpropTemplate of stack "stkLines" into field 1 of card 1 of stack "stkLines" // second stack
Re: Custom Property to field makes extra line?
I actually found out why after stepping through code for the bazillionth time
In assembling one of the lines before that line, I narrow down an object in a variable (sound familiar? I ran into this exact same thing a few days ago).
Anyway, after getting what i want into the variable, I used the line 'filter without empty'. Apparently, though, this doesn't do what I think should be happening, because even though the variable only has one line of text in it, when it is put into that field the lines following it drop down a line
I am certainly going to change that line of code to 'put line 1 of var' instead of 'filter without empty', but *now* I am curious as to what filter without empty really should be doing? Is it only supposed to take out empty lines between two points of text, or is it supposed to remove all empty lines??
In assembling one of the lines before that line, I narrow down an object in a variable (sound familiar? I ran into this exact same thing a few days ago).
Anyway, after getting what i want into the variable, I used the line 'filter without empty'. Apparently, though, this doesn't do what I think should be happening, because even though the variable only has one line of text in it, when it is put into that field the lines following it drop down a line
I am certainly going to change that line of code to 'put line 1 of var' instead of 'filter without empty', but *now* I am curious as to what filter without empty really should be doing? Is it only supposed to take out empty lines between two points of text, or is it supposed to remove all empty lines??
Re: Custom Property to field makes extra line?
As I understand it, filter without empty will remove all empty lines.
Andy Piddock
https://livecode1001.blogspot.com Built with LiveCode
https://github.com/AndyPiddock/TinyIDE Mini IDE alternative
https://github.com/AndyPiddock/Seth Editor color theming
http://livecodeshare.runrev.com/stack/897/ LiveCode-Multi-Search
https://livecode1001.blogspot.com Built with LiveCode
https://github.com/AndyPiddock/TinyIDE Mini IDE alternative
https://github.com/AndyPiddock/Seth Editor color theming
http://livecodeshare.runrev.com/stack/897/ LiveCode-Multi-Search