[comp.sys.mac.hypercard] Naming new fields

peterbak@microsoft.UUCP (Peter BAKO) (05/04/90)

How does one create a new field via a HyperCard script, and then
proceed to give a name to this new field?  Unlike a button, fields
are not given a default name, and there is no way that I can
reference to them.

on mouseUp
  doMenu "New Field"
  set the name of cd fld "" to "theField"
end mouseUp

That will not work, but it makes about as much sense as anything
else that I can thing of.  BTW, I have also tried to get the ID
number of the new field, but again how do I tell HC which field
to check?

Peter

-- 
(*)-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-\/-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+(*)
(   UUCP:         peterbak@microsoft  ||   Is this all that I am?  Is there   )
(   CompuServe:   71170,1426          ||   nothing more?    - V'ger           )
(*)-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-/\-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+(*)

imp@tik.vtt.fi (Ilkka Priha) (05/04/90)

In article <54453@microsoft.UUCP> peterbak@microsoft.UUCP (Peter BAKO) writes:
>How does one create a new field via a HyperCard script, and then
>proceed to give a name to this new field?  Unlike a button, fields
>are not given a default name, and there is no way that I can
>reference to them.
>
>on mouseUp
>  doMenu "New Field"
>  set the name of cd fld "" to "theField"
>end mouseUp
>
>That will not work.

This should work:

on mouseUp
  doMenu "New Field"
  get the number of last cd fld
  set name of cd fld it to "theField"
end mouseUp



--
Ilkka Priha                   |  Internet: priha@tik.vtt.FI
Systems Consultant            |  Bitnet:   priha:FINVTT.BITNET
Tiihonen Software Co. Ltd     |  UUCP:     mcvax!tikvtt!priha
Finland                       |  PSI-mail: PSI%204041::VTTTIK::PRIHA

KOFOID@cc.utah.edu (05/04/90)

Peter Baker writes:

> How does one create a new field via a HyperCard script, and 
> then proceed to give a name to this new field?  Unlike a button,
> fields are not given a default name, and there is no way that
> I can reference to them.
> [...]

Try this:

    on mouseUp
      doMenu "new field"
      choose browse tool
      set name of last cd fld to "boofy"
    end mouseUp

    Cheers,

        Eric.

 __________________________________________________________________
|                          (801) 581-3592                          |
|  Snail: Eric Kofoid; Dept. Biology, U. of Utah; SLC, UT 84112    |
|   Fast: bi.kofoid%science@utahcca (BitNet)                       |
| Faster: bi.kofoid@science.utah.edu (InterNet)                    |
|Fastest: kofoid@bioscience.utah.edu (InterNet -> QuickMail)       |
|                                                                  |
| -- The University of Utah is blameless for anything I've said -- |
|__________________________________________________________________|

jdevoto@Apple.COM (Jeanne A. E. DeVoto) (05/05/90)

In article <54453@microsoft.UUCP> peterbak@microsoft.UUCP (Peter BAKO) writes:
>How does one create a new field via a HyperCard script, and then
>proceed to give a name to this new field?  Unlike a button, fields
>are not given a default name, and there is no way that I can
>reference to them.

The easiest way to do this is to take advantage of the fact that newly-
created fields are at the top layer, and therefore have the highest field
number:

  on mouseUp
    doMenu "New Field"
    set the name of card field (the number of card fields) to "New Field"
    -- etc.
  end mouseUp
-- 
========= jeanne a. e. devoto ========================================
 jdevoto@apple.com     |  You may not distribute this article under a
 jdevoto@well.sf.ca.us |  compilation copyright without my permission.
______________________________________________________________________
 Apple Computer and I are not authorized      |        CI$: 72411,165
 to speak for each other.                     |  AppleLink: SQA.TEST

taylorj@yvax.byu.edu (05/05/90)

In article <4873@hemuli.tik.vtt.fi> imp@tik.vtt.fi (Ilkka Priha) writes:
>In article <54453@microsoft.UUCP> peterbak@microsoft.UUCP (Peter BAKO) writes:
>>How does one create a new field via a HyperCard script, and then
>>proceed to give a name to this new field?  Unlike a button, fields
>>are not given a default name, and there is no way that I can
>>reference to them.
>
> This should work:
>
>on mouseUp
>  doMenu "New Field"
>  get the number of last cd fld
>  set name of cd fld it to "theField"
>end mouseUp

Or better yet:

on mouseUp
doMenu "New Field"
set the name of last cd fld to "theField"
end mouseUp

If you want to do a lot of things to the new field (change typesize, align,
center, etc.), you might want to get the id of last card field, then use that,
as it's faster.


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