[comp.sys.mac.hypercard] Selecting text

klatchko@bnrmtv.UUCP (Ron Klatchko) (08/03/88)

> select <chunk> of field
I tried this and it didn't work.  I just got an error box with "Can't
understand select".  Any other ideas?

> In HyperCard 1.2 (in Authoring or Scripting mode) use
I thought I might have a earlier version but couldn't find any way to
print out the version number.  Is there a way?  Is it in one of the
premade cards?

Ron Klatchko
...!{decwrl,ucbvax}!hplabs!bnrmtv!klatchko

kurtzman@pollux.usc.edu (Stephen Kurtzman) (08/04/88)

In article <3678@bnrmtv.UUCP> klatchko@bnrmtv.UUCP (Ron Klatchko) writes:
>> In HyperCard 1.2 (in Authoring or Scripting mode) use
>I thought I might have a earlier version but couldn't find any way to
>print out the version number.  Is there a way?

Try selecting the "About Hypercard..." item under the Apple menu. That
should give you the version number plus two screens full of meaningless
names.

steve@hpiacla.HP.COM (Steve Witten) (08/05/88)

You can get the version number of HyperCard with the "Get Info..." selection
in the Finder's FILE menu.  If you are in HyperCard and just want to see the
version number you can "put the version" in the message box.  If you are in
a script and want to test the version, you can "get the version".  The version
number is returned in "it".

===============================================================================
Steve Witten                    steve%hpiacla@hplabs.HP.COM
Industrial Applications Center  {ucbvax, hplabs}!hpda!hpdsla!hpiacla!steve
Hewlett-Packard Co.             steve@hpiacla

"...I'm no fool! Nosirree!..." -- J. Cricket

dan@Apple.COM (Dan Allen) (08/07/88)

In article <3678@bnrmtv.UUCP> klatchko@bnrmtv.UUCP (Ron Klatchko) writes:
>I thought I might have a earlier version but couldn't find any way to
>print out the version number.  Is there a way?  Is it in one of the
>premade cards?

Use the "About HyperCard" item from the Apple Menu.  The first line of
the about box tells you the version number.  You can also say "put the
version" in HyperTalk.

Dan Allen
Apple Computer

taylorj@yvax.byu.edu (10/23/89)

In somebody's response to somebody else's question about selecting text in a
locked field, a formula was given to figure out which line of the field was
clicked on.  This prompted me to offer up the following for public consumption.

A while ago there was a "clickLine" function that floated around (various
incarnations have appeared as "clickedLine", "lineNumber" and so on).  This
function had a bug in it and was quickly replaced by a corrected version.  Then
a new improved "universal" version appeared in the Developer's Stack which
accounted for scrolling fields.  I improved it yet again to handle fields with
wide margins.

So if you want a handy little function to tell you which line of a field was
clicked on, here's the best one I know of:

-- Returns the number of the line clicked on in the target field
-- Accounts for scrolling fields and wide margins
function clickLine
  put the clickV - the top of the target into lineV
  if the style of the target = "scrolling"
  then add the scroll of the target to lineV
  if the wideMargins of the target then subtract 4 from lineV
  return lineV div the textHeight of the target + 1
end clickLine

Here's an example of how to use it in the script of a locked field:

-- Select the line that was clicked on
on mouseUp
  select line clickLine of me
end mouseUp


If anyone has any additions or improvements to this script, please pass them
on.


Jim Taylor
Microcomputer Support for Curriculum   |
Brigham Young University               |   Bitnet: taylorj@byuvax.bitnet
101 HRCB, Provo, UT  84602             |   Internet: taylorj@yvax.byu.edu

taylorj@yvax.byu.edu (10/30/89)

Oops!  I left off a rather important pair of parentheses in my posting.  The
example should have read:

on mouseUp
  select line clickLine() of me
end mouseUp            ^^

Sorry about any confusion this may have caused.


Jim Taylor
Microcomputer Support for Curriculum
Brigham Young University
taylorj@yvax.byu.edu

taylorj@yvax.byu.edu (11/04/89)

Nick Capon (<munnari!sirius.ua.OZ.AU!icapon@uunet.UU.NET>) reminded me of some
information that might be of interested to anyone using the clickLine()
function I posted (or the described method in general).

This only works with fields with no wrapped text.  Because HyperCard can wrap a
long line onto two or more lines yet still consider it to be only one line,
using clickLine() on one of these wrapped lines will result in identifying a
line farther down.

In most cases, clickLine is used to select short lines that aren't wrapped, so
this is not a problem.  If you need to select wrapped lines, there is a
solution, but it runs slower than clickLine() and requires version 1.2.1 or
higher (but if you aren't using version 1.2.2, you should have your head
examined).

function wrapClickLine
  set the lockText of the target to false
  click at the clickLoc  -- one click is sufficient
  set the lockText of the target to true
  return word 2 of the selectedLine
end wrapClickLine


Jim Taylor
Microcomputer Support for Curriculum
Brigham Young University
taylorj@yvax.byu.edu