How to increase the textsize of HTMLtext proportional?

Michael Doub mikedoub at gmail.com
Tue Jul 9 16:08:45 EDT 2013


A bit more suitable for easy reuse.....


on textdown
    BumpText the long id of field "test", -1
end textdown

on textup
    BumpText the long id of field "test", 1
end textup


on BumpText theObject theDirection
    if theDirection is not among the lines of "1" & return & "-1" then throw "Need 1 or -1 for theDirection"
    put the htmlText of fld 1 into theHtml
    replace "size="&quote with "size="&numtoChar(1500) in theHTML
    set the itemdel to numToChar(1500)
    if the number of items of theHTML<>1 then
       put 0 into itemCount
       repeat for each item theItem in theHTML
          add 1 to itemCount
          if itemCount=1 then
             put theItem into newHTML
             next repeat
          end if
          put 1 into counter
          put offset (">", theItem) into tClose
          put offset ("<" , theItem) into tOpen
          if tClose <> 0 then -- found it
             if tOpen <> 0 and tOpen > tClose then-- found "<" and after ">" whis is ok
                repeat forever
                   add 1 to counter
                   if char counter of theItem=quote then exit repeat
                end repeat
                put char 1 to counter-1 of theItem into theSize
                put theSize + theDirection into theSize
                put theSize into char 1 to counter-1 of theItem
             end if
          end if
          put quote&theItem after newHTML
       end repeat
       set the htmlText of theObject to newHTML
    end if
    set the textSize of theObject to \
          the effective textSize of theObject + theDirection
end BumpText




More information about the use-livecode mailing list