home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / hypercrd / hc2_x / byndhypr.sit / MenuMaster / background_2760.txt < prev    next >
Text File  |  1991-01-05  |  3KB  |  87 lines

  1. -- background: 2760 from stack: in
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 0
  5. -- name: 
  6. ----- HyperTalk script -----
  7. ----------------------------------------------------------------------
  8. --  Menu Master!
  9. --
  10. --  Cyan ΓÇó Spokane, Washington ΓÇó (509) 238-6789
  11. --
  12. --  All scripts are copyright ┬⌐ 1990 by Cyan. All rights reserved.
  13. --  You may use these scripts in your own non-commercial stacks.
  14. --
  15. ----------------------------------------------------------------------
  16.  
  17. on compress
  18.   repeat with x = the number of lines in card field theitems down to 1
  19.     if line x of card field theItems is empty then
  20.       delete line x of card field theItems
  21.       delete line x of card field commandKey
  22.       repeat with y = x to 15
  23.         put card field id (30 + y) into card field id (30 + (y-1))
  24.       end repeat
  25.       put empty into card field id 45
  26.     end if
  27.   end repeat
  28. end compress
  29.  
  30. on adjust
  31.   lock screen
  32.   set cursor to busy
  33.   get the rect of card field theitems
  34.   put 5+(16 * the number of lines in card field theitems) + item 2 of it into item 4 of it
  35.   put the rect of card field shadow into shadowRect
  36.   put item 3 of it + 1 into item 3 of shadowRect
  37.   put item 4 of it + 1 into item 4 of shadowRect
  38.   put the rect of card field commandkey into commandRect
  39.   put item 4 of it + 1 into item 4 of commandRect
  40.   set the rect of card field shadow to shadowRect
  41.   set the rect of card field theitems to it
  42.   set the rect of card field commandKey to commandRect
  43.   get the number of lines in card field theitems
  44.   repeat with x = 1 to 15
  45.     if x ΓëÑ it then hide card field id (30 + x)
  46.     else
  47.       if char 1 to 2 of line x+1 of card field theItems is "ΓÇôΓÇô" then
  48.         hide card field id (30 + x)
  49.       else
  50.         show card field id (30 + x)
  51.       end if
  52.     end if
  53.   end repeat
  54. end adjust
  55.  
  56. on testMenu
  57.   put the first word of card field themenu into menuName
  58.   show menubar
  59.   if there is a menu menuName then
  60.     delete menu menuName
  61.   end if
  62.   create menu menuName
  63.   repeat with x = 2 to the number of lines in card field theitems
  64.     get word 1 to (the number of words of line x of card field theitems) of line x of card field theitems
  65.     if char 1 to 2 of it is "ΓÇôΓÇô" then
  66.       put "-" after menu menuName
  67.     else
  68.       if char 1 of it is "Γçº" then
  69.         delete char 1 of it
  70.         put it after menu menuName
  71.         set the checkMark of menuItem (x-1) of menu menuName to true
  72.       else
  73.         put it after menu menuName
  74.         put card field id (30 + (x-1)) into M
  75.         if M is not empty then set the menuMsg of menuItem (x-1) of menu menuName to M
  76.       end if
  77.     end if
  78.     if textstyle of line x of card field theItems is "outline,condense" then
  79.       disable menuitem x-1 of menu menuName
  80.     end if
  81.     get line x of card field commandkey
  82.     if it is not empty then
  83.       set the cmdChar of menuitem x-1 of menu menuName to char 2 of it
  84.     end if
  85.   end repeat
  86. end testMenu
  87.