home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / mac / hypercar / 4747 < prev    next >
Encoding:
Internet Message Format  |  1993-01-08  |  3.2 KB

  1. Path: sparky!uunet!psinntp!vaxsar.vassar.edu!deslade
  2. From: deslade@vaxsar.vassar.edu
  3. Newsgroups: comp.sys.mac.hypercard
  4. Subject: Re: Scrolling field problem.... (my solution)
  5. Message-ID: <1993Jan8.203321.547@vaxsar.vassar.edu>
  6. Date: 8 Jan 93 20:33:21 +1000
  7. References: <1993Jan7.183928.25218@utkux1.utk.edu>
  8. Organization: Vassar College
  9. Lines: 66
  10.  
  11. In article <1993Jan7.183928.25218@utkux1.utk.edu>, danny@martha.utcc.utk.edu
  12. (Danny William McCampbell) writes:
  13.  
  14. > Hi all.  I have two scrolling fields side by side.  Each contain text.
  15. > I have enabled an option to have the fields to scroll together or
  16. > seperately.  The problem is when the fields are set to scroll together
  17. > one field has more text than the other and the last few lines of the
  18. > other field are not visible.  I cannot have this.  Is there any way
  19. > to find out what the very last scroll number is in the field with
  20. > the longest text as well as the other field so when one gets to the
  21. > end I can set the other one to the end?  Please help me........
  22. > Any suggestions on maybe a different way to go about this would be
  23. > greatly appreciated.
  24.  
  25. ----- Put this handler in your background or higher script and enjoy!   -dennis
  26.  
  27. function CalculateScroll whichFld, saveSelection
  28.   
  29.   -- Calculates the maximum scroll of the scrolling field pointed to by
  30.   -- whichFld.  It assumes that the field it is been told to work with
  31.   -- is a scrolling field; it does not matter if the field is locked.
  32.   --
  33.   -- whichFld is passed in as a string, as in:
  34.   --     CalculateScroll "bg fld 1", true
  35.   -- or
  36.   --     CalculateScroll (the target), false
  37.   --
  38.   -- saveSelection is a boolean: true means remember what text was
  39.   -- selected and select it after we are done, false means don't
  40.   -- bother.  There is a bug which causes the selection to flicker
  41.   -- if saveSelection is true: can anyone fix this?
  42.   
  43.   lock screen
  44.   -- save the current selection
  45.   put the selectedChunk into Holder
  46.   -- save whichFld's soon-to-be-altered properties
  47.   put the lockText of whichFld into locked
  48.   put the scroll of whichFld into scrolled
  49.   set the lockText of whichFld to false
  50.   
  51.   -- the following lines force HyperCard to reveal how far a field must
  52.   -- scroll to get to show the last line of its text.
  53.   select text of whichFld
  54.   type numToChar(29)
  55.   put the scroll of whichFld into result
  56.   
  57.   set the lockText of whichFld to locked
  58.   set the scroll of whichFld to scrolled
  59.   unlock screen
  60.   
  61.   if saveSelection is true
  62.   then select Holder
  63.   
  64.   return result
  65. end CalculateScroll
  66.  
  67. +----------------------------------------+----------------------------------+
  68. |                                        |   Standard disclaimer for rent.  |
  69. |  Dennis Slade Jr.                      |         +++++++++++++++          |
  70. |  2217 Mckean Street                    |         Inquire within.          |
  71. |  Philadelphia, PA  19145               +----------------------------------+
  72. |  internet: deslade@vaxsar.vassar.edu   |      Develop the world...        |
  73. |  voice:    01.215.468.4472             |    Develop yourself...           |
  74. |                                        |  AIESEC: in a country near you!  |
  75. +----------------------------------------+----------------------------------+
  76.