[comp.sys.mac.hypercard] Copying a background

mesard@bbn.com (Wayne Mesard) (05/05/89)

I'm working on a stack which has three backgrounds that are very similar
to each other (1 different button and a slightly modified picture).  Now
I was damned if I was going to create the bg three times when the right
thing to do is do it once and then copy that bg to the two new bg's and
make the small changes.  But HC didn't give me an easy way to do it.

Here's the kludgey way I got around it:

1) Copy a card from bg 1.

2) Open a new, temporary stack.

3) Paste the card into the new stack.

4) Make the changes on this card, including changing the name of the
   background.

5) Copy this card.

6) Go back to the original stack and paste in the card (with the new
   background).

So I found a way around this limitation, but in other situations there's
no easy solution.  E.g., if you want to replicate the objects on card 1
in card 2 but using an existing background.

The HyperTalk Bible recommends a pd script named Groupies for this task,
but it would be so much simpler if HC did one or more of the following:

A) When in Background mode, the {Cut,Copy} Card menu items should change
   to {Cut,Copy} Background.  (And Paste Card becomes Paste Background.)

B) The background of a card should be a set'able property of that card.
   Thus,
             set background of this card to "MyOtherBg"

-- 
void *Wayne_Mesard();         Mesard@BBN.COM         BBN, Cambridge, MA

dan@Apple.COM (Dan Allen) (05/05/89)

In article <39528@bbn.COM> mesard@BBN.COM (Wayne Mesard) writes:
>
>A) When in Background mode, the {Cut,Copy} Card menu items should change
>   to {Cut,Copy} Background.  (And Paste Card becomes Paste Background.)
>
>B) The background of a card should be a set'able property of that card.
>   Thus,
>             set background of this card to "MyOtherBg"

Thanks for the ideas and input.  The one problem with copying and
pasting a background in the same stack is that by doing so there will be
two identical backgrounds.  How do you know which is which?  By ID would
be the only way.  A script could duplicate a background (more or less)
with the following script:

on duplicateBackground
  lock screen
  put the id of this card into old
  doMenu "New Background"
  put the id of this card into new
  go old
  choose field tool
  repeat with i = 1 to the number of fields
    select field i
    doMenu "Copy Field"
    go new
    doMenu "Paste Field"
    go old
  end repeat
  choose button tool
  repeat with i = 1 to the number of bg btns
    select bg btn i
    doMenu "Copy Button"
    go new
    doMenu "Paste Button"
    go old
  end repeat
  choose select tool
  doMenu "Background"
  doMenu "Select All"
  doMenu "Copy Picture"
  go new
  doMenu "Paste Picture"
  go old
  choose browse tool
  get the script of this bg
  go new
  set the script of this bg to it
end duplicateBackground

I just wrote this in a few moments and have briefly tested it.  It
allows background fields and buttons to be copied, as well as the
background's script and picture.  No card specific information is
copied.  Perhaps other enhancements could be made, but this is another
example of how many, many things can be done with HyperTalk.  Yes, it
would be nice if we had a copy and paste of a background, but it is very
rare that it is needed.  For those that want to do it, the above script
does it!

Thanks again for the input.

Dan Allen
HyperCard Team
Apple Computer

johnsot@nyevax.CAS.ORST.EDU (Tim G. Johnson) (05/08/89)

In article <30160@apple.Apple.COM> dan@Apple.COM (Dan Allen) writes:
>In article <39528@bbn.COM> mesard@BBN.COM (Wayne Mesard) writes:
>>
>>A) When in Background mode, the {Cut,Copy} Card menu items should change
>>   to {Cut,Copy} Background.  (And Paste Card becomes Paste Background.)
>>
>>B) The background of a card should be a set'able property of that card.
>>   Thus,
>>             set background of this card to "MyOtherBg"
>
>Thanks for the ideas and input.  The one problem with copying and
>pasting a background in the same stack is that by doing so there will be
>two identical backgrounds.  How do you know which is which?  By ID would
>be the only way.  A script could duplicate a background (more or less)
>with the following script:
>
>   --- Script Deleted ---
>
>I just wrote this in a few moments and have briefly tested it.  It
>allows background fields and buttons to be copied, as well as the
>background's script and picture.  No card specific information is
>copied.  Perhaps other enhancements could be made, but this is another
>example of how many, many things can be done with HyperTalk.  Yes, it
>would be nice if we had a copy and paste of a background, but it is very
>rare that it is needed.  For those that want to do it, the above script
>does it!

Dan, you are wrong about this being a very rare need. I have needed the
ability to copy a background on several different occasions. But you are
right, it is very simple to solve using hypertalk. All you need to do is
to copy the card, change the name of the bg ever so slightly, paste the
card, change the name of the original bg back to the original, and then
modify your duplicate (much easier than brute force copying each cd and
bg item across to a blank bg). More importantly, though, I've needed the
ability to change the background that a certain card references, which is
the second point that was originally mentioned.

I am developing a stack that has 6 VERY similar backgrounds each having
several cards. As the users find inadeqecies in my interface, I modify the
most used group of card's background untill it meets the user's needs. Then
I need to propogate those changes to the other 5 backgrounds. This can be
tedious and error prone when I have to do it by hand (there have been times
that I've had to add 24 invisible buttons over the top of two columns of a
field).

If I could make a copy of the fixed background and just make the minor
modifications to the new background, and then set all the cards to use
that new bg, then I wouldn't have to always spend time copying buttons
and fields.

As it is, I have a script that makes a generic copy of the bg that contains
all the necessary changes. It makes a copy of that, makes the minor changes
for each type of bg, and then makes new cards in that bg, one at a time,
copying over any card specific text from the old cd of the old bg, then
deletes all the old cards. As you can imagine, this adds quite a bit of
mystery to anyone who might want to try to understand my scripts.

So I would like to echo the request:

>>B) The background of a card should be a set'able property of that card.
>>   Thus,
>>             set background of this card to "MyOtherBg"

Thanks for listening.


-- 
-Tim G. Johnson
-johnsot@mist.CS.ORST.EDU

newman@ut-emx.UUCP (Dave Newman) (05/09/89)

What this thread seems to imply to me is that we need a way to inherit
material from other backgrounds.  I too have a stack with several similar
backgrounds, and the ideal thing would be to create one bg with all the 
common elements, and inherit those features in the other backgrounds.

I know this would be tough in HyperCard, and terribly incompatible with
earlier releases.  But, it is something to think about, and it just points
out the desirability of a completely object-oriented environment.

>>Dave 

dan@Apple.COM (Dan Allen) (05/09/89)

In article <445@nyevax.CAS.ORST.EDU> johnsot@mist.CS.ORST.EDU (Tim G. Johnson) writes:
>So I would like to echo the request:
>>>B) The background of a card should be a set'able property of that card.
>>>   Thus,
>>>             set background of this card to "MyOtherBg"

Thanks again for the input.  This does sound like a useful thing.  We'll
see what we can do...

Dan Allen
Apple Computer

DN5@PSUVM.BITNET (05/09/89)

Yes, copying a background isn't hard to do.  Just choose Copy Card from
the menu, then change ANYTHING about the background (I just go to the
background, paint a dot, then go back to the foreground), then choose
Paste Card.  The new background will be a copy of the old background.  Then
go back and undo whatever change you made to the old background, and you
have two similar but distinct backgrounds.

There are many valid reasons to copy a background (or rather to want to
copy a background).  If I have several sets of cards which group into a
logical grouping, even if their backgrounds look alike, I put them in
different backgrounds so that I can reference them through their background.

I think that the trouble lies in that there is only 2 level: Card and
Background.  I would like to see multiple levels of background, with each
inheriting everything from its ancestors, and adding new things of its own.
That way you can change items at the most appropriate level, and do this with
the least effort.  In many ways HyperCard tries to be object-oriented, but
it does this in a very limited way.

These thoughts (chaotic as they are) are merely my two cents worth in this
discussion.

                               Jay, etc.. (D. Jay Newman)

ollef@osiris.sics.se (Olle Furberg) (05/09/89)

In article <445@nyevax.CAS.ORST.EDU> johnsot@mist.CS.ORST.EDU (Tim G. Johnson) writes:
>Dan, you are wrong about this being a very rare need. I have needed the
>ability to copy a background on several different occasions>
>So I would like to echo the request:
>
>>>B) The background of a card should be a set'able property of that card.
>>>   Thus,
>>>             set background of this card to "MyOtherBg"
>

I agree. I find the bkgnds very hard to deal with. This boils down to the fact
that there's no simple way to copy, cut and paste them.

       Please put this feature into 2.0 !

 In my nightmares I have hundreds of cards with wrong background. This also
happens to me when I'm awake.

          /Olle



PS. I don't think a bkgnd could be a set'able property because a bkgnd is an
object. I want commands that behaves like this:


  Change this bkgnd to AnotherBackground  --puts all cards in this bkgnd into
                                          --bkgnd AnotherBackground

  Change bkgnd of MyCard to AnotherBackground --as above but just for MyCard

  Copy bkgnd AnotherBackground

  Paste bkgnd into MyBkgnd  --changes MyBkgnd to a copy of AnotherBkgnd
  
  Paste bkgnd into MyCard   --changes bkgnd of MyCard to a copy of AnotherBkgnd

stadler@Apple.COM (Andy Stadler) (05/10/89)

In <many articles> <lots of people> write:

>  [There's no good way to change bkgnd's, bkgnd data, associate cards
>   with given bkgnds, etc, etc]

There are unfortunately other problems with simply "assigning" arbitrary
card and background combinations.  A card and a background aren't just two
independent layers!  A card is built on top of a background.  For example,
a background field has text stored in the card on a card by card basis.
I'm not saying it's impossible to stick any card with any background, but
there are many potential problems involved.

What I'd like to hear is, what level of power-user-tool vs. stack integrity
are you (a reasonably high-power set of users from reading these messages)
interested in?

--Andy           stadler@apple.com

rich@sendai.sendai.ann-arbor.mi.us (K. Richard Magill) (05/11/89)

You know, I really can't imagine why I'd want to do this?  Are you
folks using backgrounds with no fields or buttons?  If your
backgrounds *have* fields, how do you expect them to be translated
into the new background, short of wiping them all clean?

If you are really working with empty backgrounds (ie, paint only),
then maybe a more useful tool would be a rectangle select that can
pick cut/paste multiple combinations of buttons/fields from card to
card.  This way you could copy the entire non-background part of a
card onto a new card with a presumably different background.
--
rich.

ollef@osiris.sics.se (Olle Furberg) (05/12/89)

In article <RICH.89May11113943@sendai.sendai.ann-arbor.mi.us> rich@sendai.ann-arbor.mi.us writes:

>Are you folks using backgrounds with no fields or buttons? 

No I have buttons, fields, graphics _and_ script in my backgrounds.

>If your
>backgrounds *have* fields, how do you expect them to be translated
>into the new background, short of wiping them all clean?

Simple: the content of field number K in the old bg goes into field
number K in the other bg. If the number of fields in the other bg is less than
the old you get an alert:

 ===========================================================================
   The number of fields in this background exceeds the number of fields  
   in the target background. If you proceed you will lose the contents  
   of field ## to field ##.                                              
                                                                       
                   CANCEL              GO ON!                               
 =============================================================================

>If you are really working with empty backgrounds (ie, paint only),
>then maybe a more useful tool would be a rectangle select that can
>pick cut/paste multiple combinations of buttons/fields from card to
>card. 

That would be great, shift-click to extend a selection etc!

>This way you could copy the entire non-background part of a
>card onto a new card with a presumably different background.

No! You would lose the card script and the contents of the fields.



To summarize: I want the following commands:

  1. Move a single card to another bg
  2. Move all cards sharing one and the same bg to another bg
  3. Change a bg to a _copy_ of another bg for a single card
  4. Change a bg to a _copy_ of another bg for all cards sharing one
      and the same bg

(N.B. 2 (3) decrease (increase) the number of bg. In 1 and 4 the number of bgs
is unchanged)

Two questions:   Is 2 (4) _really_ a generalisation of 1 (3) ?


          /Olle