How to amend or hide the text using Livecode?

101 views Asked by At

I have scrolling field it's contain some text and equation the equations are placed in between \begin{equation} and end{equation} also some equation are placed in between $$. Now I want hide all equations in the scrolling field also it's must be restored when i click restore button. Now I just replace the equations.

1

There are 1 answers

2
Devin On BEST ANSWER

You can use the hidden property, but it is a property that only applies to lines in fields. You would have to work out some way of putting the equations on a line by themselves, then setting the hidden to true. You'd have to keep track of which lines are hidden in order to be able to restore them. Something like this should hide the first occurrence of an equation delimited by $$. Of course you'd have to iterate through the entire text to find them all, and you'd have to also find the \begin and \end delimiters.

put offset("$$",fld "mytext") into tFoundEquationStart
put the number of lines in char 1 to tFoundEquationStart of fld "mytext" into tEqStartLine
put tFoundEquationStart & cr after tFoundList
put cr into char tFoundEquationStart
put offset("$$",fld "mytext") into tFoundEquationEnd
put comma & tFoundEquationEnd after last line of tFoundList
set the hidden of line tEqStartLine of fld "mytext" to true

To restore the equations you would iterate through the list in tFoundList and replace the return characters with the original delimiters.