on mouseUp
put the htmlText of field "MytextField" into myHtml
put lineOffset("begin{equation}",myHtml) into tBegin
put lineOffset("end{equation}",myHtml) into tEnd
set the hidden of line tBegin to tEnd in fld "MytextField" to true
end mouseUp
Equation Hiding using lineOffset
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Equation Hiding using lineOffset
I am Beginner in Livecode. I got a code for hiding equations in my Scrolling field, The equations starts with "\begin{equation}" and ends with "\end{equation}", In between these two tags equations are placed. My problem is my code is executed only once. My Scrolling field contains lots equations. Also, I want to restore these equations when I press a button. using loops how I rewrite my code
--
Thanks
Shalu S
Thanks
Shalu S
Re: Equation Hiding using lineOffset
Hi.
Welcome to LC.
I had never used the "hidden" command. It is odd, in that when it hides a line, though that line is still intact in the field, the other lines fill upward as if that line was deleted. Odd command.
Anyway, are all your equations on one line? You would not need the end tag if so.
When you want to hide subsequent lines, store the line number of the previous one, and use the "lines to skip" parameter in the lineOffset function. Where might you store this value? Write back if you need more help with this.
To restore, just loop through all the lines in the field, and set the hidden of each line to "false", regardless of the current state of that line. Or test the hidden property of each line and only restore if true. Or keep a list of the hidden lines, and only restore from that list, which might be faster if you have a very long field. All are valid approaches, and you might try to work each one as an exercise. Exercise keeps you healthy.
Craig Newman
Welcome to LC.
I had never used the "hidden" command. It is odd, in that when it hides a line, though that line is still intact in the field, the other lines fill upward as if that line was deleted. Odd command.
Anyway, are all your equations on one line? You would not need the end tag if so.
When you want to hide subsequent lines, store the line number of the previous one, and use the "lines to skip" parameter in the lineOffset function. Where might you store this value? Write back if you need more help with this.
To restore, just loop through all the lines in the field, and set the hidden of each line to "false", regardless of the current state of that line. Or test the hidden property of each line and only restore if true. Or keep a list of the hidden lines, and only restore from that list, which might be faster if you have a very long field. All are valid approaches, and you might try to work each one as an exercise. Exercise keeps you healthy.
Craig Newman
