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
csz...@mac.com




_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to