home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.hypercard
- Path: sparky!uunet!sun-barr!cs.utexas.edu!sdd.hp.com!elroy.jpl.nasa.gov!orchard.la.locus.com!optimla!mike
- From: mike@optimla.aimla.com (Mike Diehr)
- Subject: Text insertion point
- Message-ID: <1992Aug18.230318.26465@aimla.com>
- Sender: news@aimla.com
- Nntp-Posting-Host: chondrite
- Organization: Philips Interactive Media
- Date: Tue, 18 Aug 92 23:03:18 GMT
- Lines: 32
-
- Is there any way to change the contents of a field without affecting the
- insertion point?
-
- I have a field that the user types into, and I'd like to have two other
- fields that indicate the number of letters and words in the field.
-
- I wanted to continually update these values, by using an "On Idle" script.
- However, when the field says "put X into me", it moves the insertion point
- to that field, and the user can no longer type.
-
- A work around that I tried was to do this in the word count field:
-
- on SetupField
- repeat with i = 1 to 100
- put i into line i of me
- end repeat
- end SetupField
-
- on Update
- put the length of field "foo" into X
- set the scroll of me to X * the lineHeight of me
- end Update
-
- where SetupField is called once, and Update is called on the idle handler.
- The trick is, that I am not putting anything into the field, but only
- changing it's scroll position, so the text insertion point shouldn't
- be changed.
-
- However, with this method, strange things happen. If I select some text and
- hit the "delete" key, and then hit return, it tries to execute the
- contents of the message box, even if it is closed.
-
-