[comp.sys.mac.hypercard] Backgrounds, sub

abdenour@mist.cs.orst.edu (Abdennour A. MOUSSAOUI) (03/13/90)

I am new to hypercard programming. and I have some questions.
Is it possible to have two backgrounds in one stack that have common
things between them and also different things also.
Let me explain, let us say that I have 100 cards all sharing the same
background (fields,buttons, icons,drawings) plus that 10 of these 100
cards also share in addition other things(buttons,fields, ..) between
these 10 cards.
is it possible to define one background in terms of another?
currently I only know how to define a background from scratch.
I mean, If I have a backgound that has a,b,c can I define another
that have a,b,c plus d,e,f (like a super set)?
I can go to each of these 10(could be more) cards and add to each one
the extra things, but it is cumbersome and also hard to position the fields,
buttons, icons in the exact position in each card.

So, if oyu understand my question and have an answer for it, then
please post it? 

thank you!
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /\   !    ~~~~Hayaa Ala-falaah  
Abdennour Moussaoui              || _~_~_      Allahu Akbar Allahu Akbar  
Oregon State University          ||(_____)     Laa Illaha Ila Allah~~~~
email=abdenour@mist.cs.orst.edu  |||_|_|_|  

dale@bcm.tmc.edu (Dale A. Samuelsen) (03/14/90)

In article <16814@orstcs.CS.ORST.EDU> abdenour@mist.cs.orst.edu (Abdennour 
A. MOUSSAOUI) writes:

> I have 100 cards all sharing the same
> background (fields,buttons, icons,drawings) plus that 10 of these 100
> cards also share in addition other things(buttons,fields, ..) between
> these 10 cards.
> is it possible to define one background in terms of another?
> currently I only know how to define a background from scratch.
> I mean, If I have a backgound that has a,b,c can I define another
> that have a,b,c plus d,e,f (like a super set)?

Yes it is possible to do this.  Under the Objects menu there is a menu 
item called "New Background".  This menu item will present a dialog box to 
you.  In the bottom left hand corner of this dialog box is a check-box 
which gives you the option of using the current background as the basis on 
which to build your new background.  Make sure this box is checked, then 
simply add your new buttons to the new background for the new set of cards.

Dale A. Samuelsen
Baylor College of Medicine
dale@bcm.tmc.edu
--Any opinions expressed here are mine alone and do not necessarily represent 
  those of Baylor College of Medicine.

jgsmith@watson.bcm.tmc.edu (James G. Smith) (03/14/90)

Keep in mind that when you create this new background which looks just like
the old one, it is still a completely new background.  If you change one
of the items which the new background shares with the old one, the changes will
only occur in in the new one.

*

dale@bcm.tmc.edu (Dale A. Samuelsen) (03/14/90)

In article <285@gazette.bcm.tmc.edu> dale@bcm.tmc.edu (Dale A. Samuelsen) 
writes:
> In article <16814@orstcs.CS.ORST.EDU> abdenour@mist.cs.orst.edu 
(Abdennour 
> A. MOUSSAOUI) writes:
> 
> > I have 100 cards all sharing the same
> > background (fields,buttons, icons,drawings) plus that 10 of these 100
> > cards also share in addition other things(buttons,fields, ..) between
> > these 10 cards.
> > is it possible to define one background in terms of another?
> > currently I only know how to define a background from scratch.
> > I mean, If I have a backgound that has a,b,c can I define another
> > that have a,b,c plus d,e,f (like a super set)?
> 
> Yes it is possible to do this.  Under the Objects menu there is a menu 
> item called "New Background". This menu item will present a dialog box to 
> you.  In the bottom left hand corner of this dialog box is a check-box 
> which gives you the option of using the current background as the basis on 
> which to build your new background.  Make sure this box is checked, then 
> simply add your new buttons to the new background for the new set of cards.

Ok - ok... its time for me to 'fess up.  

If you try out my above method of creating a new background, you'll find out that I lied through my teeth.  Sorry about that.  What I was really thinking 
about was creating new stacks with similar backgrounds rather than 
copying one background to another.

Sheesh - you'd think a guy'd check out his facts before wasting bandwidth. 

Believe it or not, I realized my mistake when showing hypercard to (of 
all people) an IBM sales rep.

What I should have said above is that to copy items from one background to 
another you must first create a new background (under the Objects menu), 
then -while in background mode - copy the items one at a time from the old 
background to the new.  That's much more tedious than my fantasy method, 
but much more effective :-).

Any flames, brickbats, maledictions, etc. about my earlier posting are 
well deserved, and should be sent to me via e-mail at your earliest 
convenience.

Sorry about the earlier mis-information.

Dale A. Samuelsen
Baylor College of Medicine
dale@bcm.tmc.edu
--Any opinions expressed are mine alone and do not necessarily represent 
those of Baylor College of Medicine.

DN5@psuvm.psu.edu (03/14/90)

-    I have 100 cards all sharing the same
-    background (fields,buttons, icons,drawings) plus that 10 of these 100
-    cards also share in addition other things(buttons,fields, ..) between
-    these 10 cards.
-    is it possible to define one background in terms of another?
-    currently I only know how to define a background from scratch.
-    I mean, If I have a backgound that has a,b,c can I define another
-    that have a,b,c plus d,e,f (like a super set)?

The traditional way is to create a clean background, and then copy
over everything (don't forget any background graphics) into the
new background.

There is, however, a much easier way.  Copy a card (by choosing the
menu item).  Then make any change to the background (even 1 pixel
to the background graphics does it).  Then paste the card where you
want the new background.  By comparing background ids, you will
notice that the background for this new card has a different id
than the original background.  You can now go back to the original
card, and fix the background graphic (or whatever else you changed).

This works because when you copy a card (put it into the clipboard),
the complete information for that card includes a complete description
of the background -- in case you were to paste it into another stack.
When it is pasted back, it compares ids with any backgrounds in the
stack, and ONLY if the backgrounds are IDENTICAL (I assume by
checksum or somesuch device) will the id remain the same.  Otherwise
the pasted background is given a new id number, and assumed to be
a completely different background.

Simple, easy, and totally non-obvious.  There should have been
a better way of copying a background, or better yet, getting
rid of the background/card dicotomy, and having multiple levels
of background, each inheriting things from its ancestors.

                          D. Jay Newman
                          dn5@psuvm.psu.edu

roger@caldwr.UUCP (Roger Linder) (03/14/90)

In article <285@gazette.bcm.tmc.edu> dale@bcm.tmc.edu (Dale A. Samuelsen) writes:
>Yes it is possible to do this.  Under the Objects menu there is a menu 
>item called "New Background".  This menu item will present a dialog box to 
>you.  In the bottom left hand corner of this dialog box is a check-box 
>which gives you the option of using the current background as the basis on 
>which to build your new background.  Make sure this box is checked, then 
>simply add your new buttons to the new background for the new set of cards.
>

What version of Hypercard does this?  I'm using 1.2.5 and receive no dialog for
"New Background".  I know of a dialog and check box to copy current background
when "New Stack..." is selected. 

My solution is:

	1. Create a new stack and check "Copy current background".  This also
	   copies the stack and background scripts (and executes any 
	   "openStack", "openBackground"  and "openCard" handlers).

	2. Make your changes to the background in the new stack.

	3. Copy the card and paste into the old stack.  Since the new
	   background now differs from the old background, a new ID is created.
	   (If no changes are made to the new background, it merely becomes
	   another card in the old background.)

It works, but involves extra steps over a simple "New Background" dialog.
Changes to old and new backgrounds later will not be reflected in the
counterpart.

(I hope this article isn't being seen twice.  I may have screwed up in sending
it the first time.)
-- 
+--Roger D. Linder-(Yes, the famous one)-----v Department of Water Resources  |
|                                            | roger@water.ca.gov             |
|  Only Golden Fingers Could Play So Heavy   | Sacratomato, CA                |
+--------------------------------------------^--------------------------------+

jgsmith@watson.bcm.tmc.edu (James G. Smith) (03/15/90)

The way I would make a new background starting out looking just like another
background is to go to any card in the original background, copy the card
to the clip board, change the name of the current background, and then paste 
the card on the clip board.  You will now have to backgrounds which look idential.  I have done this.  Let me say it this way:

doMenu "Copy Card"
set name of this bkgnd to "Some Other Name"
doMenu "Paste Card"

-- if you want to switch names back, then

put short name of this background into theName
set name of bkgnd "Some Other Name" to theName
set name of this bkgnd to "Some Other Name"

-- this last part I have NOT tried...I'm not sure you can set the name of a
-- a background from another background...but I don't see why not.

*
(please don't flame my impromptu script...I now see multiple ways to make it
better.)
(has anyone else started communicationg in HyperTalk?)

dale@bcm.tmc.edu (Dale A. Samuelsen) (03/16/90)

In article <731@caldwr.UUCP> roger@caldwr.UUCP (Roger Linder) writes:
> What version of Hypercard does this?  I'm using 1.2.5 and receive no 
dialog for
> "New Background".

Guilty as charged - I posted a retraction to this one a couple of hours after I posted the mistaken solution.  Sorry about the error.  Chalk it up
to ... um .... er, well chalk it up to whatever you wish, but I goofed. :-)

Dale

Dale A. Samuelsen
Baylor College of Medicine
dale@bcm.tmc.edu
--Any opinions expressed are mine alone and do not necessarily represent 
those of Baylor College of Medicine.

gzp@mentor.cc.purdue.edu (Bob Sikorski) (03/20/90)

In article <287@gazette.bcm.tmc.edu> dale@bcm.tmc.edu(Dale A. Samuelsen) writes:
>> In article <16814@orstcs.CS.ORST.EDU> abdenour@mist.cs.orst.edu  writes:
>> > is it possible to define one background in terms of another?
>
>What I should have said above is that to copy items from one background to 
>another you must first create a new background (under the Objects menu), 
>then -while in background mode - copy the items one at a time from the old 
>background to the new.  That's much more tedious than my fantasy method, 
>but much more effective :-).
>
>Dale A. Samuelsen

I'm not sure if this will be helpful or not, but for a large number of buttons
and/or fields, this could also be very tedious.  I made a temporary stack and
copied the card with the desired subset background into this stack.  Then I 
added a few buttons or fields, and cut this new card out of the temporary
stack and pasted it back into the original.  Cards that have been pasted into
a stack no longer copy the background of those in front of it.  I'm sure
there are easier ways than this (e.g. writing a script), but this was great
for a person who didn't know too much about script writing.  Hope it helps.

                     Bob Sikorski
                     Purdue University
                     gzp@mentor.cc.purdue.edu