empty lines in field
Posted: Fri Nov 12, 2010 2:36 pm
When a field is sorted the empty lines are at the top. How can I delete these empty lines?
Questions and answers about the LiveCode platform.
https://forums.livecode.com/
Code: Select all
on DoNoLineEmptyInFld
put "myField" into LeCurFld
put NoLineEmpty(LeCurFld) into fld LeCurFld
end DoNoLineEmptyInFld
function NoLineEmpty pFld
put fld pFld into rNoLineEmpty
put the num of lines of rNoLineEmpty into nbl
repeat with i = nbl down to 1
if line i of rNoLineEmpty = empty then
delete line i of rNoLineEmpty
wait 2 milliseconds
end if
end repeat
return rNoLineEmpty
end NoLineEmpty
Code: Select all
on mouseUp
repeat for 100
if line 1 of fld "myField" is empty then
delete line 1 of fld "myField"
else
exit repeat
end if
end repeat
end mouseUp
Code: Select all
on mouseUp
put word 1 of fld "myField" into firstWord
delete line 1 to (lineOffset(firstWord,fld "myField") - 1) in fld "myField"
end mouseUp
Code: Select all
...
put fld "with empty lines" into tField
lock screen
repeat for each line tLine in tField
## "repeat for each..." is READ only, so we cannot modify the content of tLine!
## But creating a new text variable will do
if tLine <> empty then
put tLine & CR after tNew
end if
end repeat
delete char -1 of tNew
put tNew into fld "with empty lines"
unlock screen
...
Code: Select all
filter fld "myField" without EMPTY