home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / mac / hypercar / 4750 < prev    next >
Encoding:
Text File  |  1993-01-09  |  2.5 KB  |  81 lines

  1. Path: sparky!uunet!munnari.oz.au!metro!socs.uts.edu.au!kralizec.zeta.org.au!ixgate!peter.anderson
  2. From: peter.anderson@f914.n714.z3.fido.zeta.org.au (Peter Anderson)
  3. Message-ID: <b491090a@Kralizec.fido.zeta.org.au>
  4. Newsgroups: comp.sys.mac.hypercard
  5. Subject: RE-pop-up menus
  6. Organization: Fidonet. Gate admin is fido@socs.uts.edu.au
  7. Date: 31 Dec 92 10:02:27 GMT
  8. Lines: 71
  9.  
  10. Original to: aaron.schrab
  11.  
  12. The following uses a pure Hypercard method of providing popup menus.  There
  13. is a '?' (Help) button adjacent to the field where you require the input
  14. from the pop-up menu.  The 'RINALDI' collection of XCMDs (available on most
  15. Mac BBSs also contain some good menu XCMDs.  I can send you a disk with the
  16. stack if you wish.
  17.  
  18. Peter Anderson
  19. 31 Sheaffe Street
  20. HOLDER   ACT   2611
  21. AUSTRALIA
  22.  
  23. -----------------------------------
  24. The following script goes in the STACK script.
  25. The purpose of this script is to set-up the data for the pop-up menu.
  26. This technique has the advantage that it can be used in any card within
  27. the stack as it is available globally.  Also as many menus as required 
  28. can be set up.  The contents of the menus are also available for
  29. modification in ONE place.
  30.  
  31. on openStack
  32.   global citiesMenu
  33.   -- Field selection menu setup
  34.   put "Adelaide,Brisbane,Canberra,Darwin,Hobart,Melbourne,"┬
  35.   & "Perth,Sydney" into citiesMenu
  36. end openStack
  37.  
  38. on closeStack
  39.   stop using stack "Print The Scripts"
  40. end closeStack
  41.  
  42. on openCard
  43.   hide bg field "Valid cities"
  44.   put the number of this card into bg field "Card number"
  45.   put the number of cards into bg field "Number cards"
  46. end openCard
  47.  
  48. -----------------------------------
  49. The following script goes with a '?' button adjacent to 'City' field.
  50. The purpose of this script is to display the list of valid choices as a
  51. pop-up menu.
  52.  
  53. on mouseUp
  54.   global citiesMenu
  55.   put 1 into itemNumber
  56.   repeat for number of items in citiesMenu
  57.     put item itemNumber of citiesMenu into line itemNumber of ┬
  58.     bg field "Valid cities"
  59.     add 1 to itemNumber
  60.   end repeat
  61.   show field "Valid cities"
  62. end mouseUp
  63.  
  64. -----------------------------------
  65. The following script goes with a background field called "Valid cities"
  66. The purpose of this script is to copy the selected item into the fore-
  67. ground field.
  68.  
  69. on mouseUp
  70.   get the value of the clickLine
  71.   if it is empty then
  72.     hide field "Valid cities"
  73.     exit mouseUp
  74.   end if
  75.   put it into bg field "City"
  76.   hide bg field "Valid cities"
  77. end mouseUp
  78.  
  79. --- Tabby 3.0
  80.  * Origin: *MacConnection*  Sydney, Australia. 61-2-907-9198  (3:714/914)
  81.