A problem with Font Menu in LC Resource Center

Charles Szasz cszasz at mac.com
Fri Apr 6 22:44:43 EDT 2012


Jacque,

Here is my script:

on menuPick theMenuItem
   set the itemDelimiter to "|"
   switch item 1 of theMenuItem ---the submenu name
      case "Font"
         set the textFont of field "Example Text"\
                to item 2 of theMenuItem
         break
      case "Size"
         set the textSize of field "example Text"\ 
                to item 2 of theMenuItem 
         break
      case "Plain"
         ---Plain removes all styles:
         set the textStyle of field "example text" to empty
         break
      case "Bold"  ---These two remaining menu items
         break
      case" Italic"  ---are handled with the same piece of code!
         break
         put the textStyle of field "example text" into currentStyle
         set the itemDelimiter to comma
         if theMenuItem is among the items of currentStyle then
            ---already has that style, so remove it
            delete item (itemOffset(theMenuItem,currentStyle))\
            of currentStyle
         else
            ---add the style to any existing styles
            if currentStyle is "Plain"
            then put theMenuItem into currentStyle
            else put comma & theMenuItem after currentStyle
         end if
         set the textStyle of field "Example Text" to currentStyle
   end switch
end menuPick


Charles Szasz
cszasz at mac.com







More information about the use-livecode mailing list