Creating a Font menu

Mark Talluto fuegox at mac.com
Thu Apr 25 00:57:01 EDT 2002


> I'd like to create a font menu that lists the fonts that are available 
> on
> the users system.
>
> I've figured out how to setup a hierarchal menu, but couldn't figure 
> out how
> to setup the fonts.  Any tip would be greatly appreciated.
>
> Many Thanks!
>
>
> --
> Dave
> Retiarius Enterprises


Dave,

This is the script I use for fonts in a menubar:
You will have to adjust the stack and group names to your needs though.


   --SET UP THE TEXT SIZES FOR THIS SYSTEM
   put "(Size" & return into button "text" of group "main menu" of stack 
"list"
   put tab & "7" & return after button "text" of group "main menu" of 
stack "list"
   put tab & "8" & return after button "text" of group "main menu" of 
stack "list"
   put tab & "10" & return after button "text" of group "main menu" of 
stack "list"
   put tab & "12" & return after button "text" of group "main menu" of 
stack "list"
   put tab & "15" & return after button "text" of group "main menu" of 
stack "list"
   put tab & "18" & return after button "text" of group "main menu" of 
stack "list"
   put tab & "20" & return after button "text" of group "main menu" of 
stack "list"
   put tab & "24" & return after button "text" of group "main menu" of 
stack "list"
   put tab & "28" & return after button "text" of group "main menu" of 
stack "list"
   put tab & "32" & return after button "text" of group "main menu" of 
stack "list"

   --SET UP THE FONTS FOR THIS SYSTEM
   put the fontnames into lFonts
   sort lFonts

   put "(Fonts" & return after button "text" of group "main menu" of 
stack "list"
   put the num of lines of lFonts into lRepeat
   repeat with x = 1 to lRepeat
     put tab & line x of lFonts & return after button "text" of group 
"main menu" of stack "list"
   end repeat

   --GET RID OF THE EXTRA SPACE AFTER ALL THE FONTS
   put the num of lines of button "text" of group "main menu" of stack 
"list" into tLines
   repeat 2
     delete line tLines of button "text" of group "main menu" of stack 
"list"
   end repeat


-Mark Talluto




More information about the use-livecode mailing list