Page 1 of 2
background and foreground
Posted: Sat Dec 23, 2023 9:00 pm
by danielrr
There was a programming environment for the Mac many years ago... well, surely no one remembers it, but the fact is that in this environment, which was also based on the concept of a stack, there was a basic opposition between background and card (foreground). This was very useful for applications such as the following: imagine a map on which we're going to develop a story (a kind of historical atlas) programming a series of events: the map would be in the background, and each card could be used to create different episodes that took place against that backdrop.
Naturally, LiveCode is an incomparably more developed environment, and many ways come to mind to do the same thing, but what is the most elegant and cost-effective way to use the same background shared by all the "cards" in a stack? Could you point me to a good example of a LiveCode stack where this is done?
Many thanks in advance.
Re: background and foreground
Posted: Sat Dec 23, 2023 9:11 pm
by richmond62
Re: background and foreground
Posted: Sat Dec 23, 2023 9:39 pm
by richmond62
Here's a very simple example I just made:
-
Re: background and foreground
Posted: Sat Dec 23, 2023 11:27 pm
by dunbarx
Hi.
Are you speaking of Hypercard?
The background implementation there is not the same as it is in LiveCode, where that concept is assigned to the behavior of groups. But since groups can be of any composition, like, as Richmond suggests, an image, that functionality can be easily (and better) implemented.
So whereas in HC one creates background buttons and fields, say, and these can be placed on any or all cards, and automatically when making a new card, in LC you use instead groups, and they have much the same behavior. Check out the "backGroundBehavior" in the dictionary.
It took me a long time to grudgingly admit that anything HC could do LC could do better. But that was obvious from the start; I just am ill-tempered.
Craig
Re: background and foreground
Posted: Sun Dec 24, 2023 1:03 am
by stam
danielrr wrote: ↑Sat Dec 23, 2023 9:00 pm
Naturally, LiveCode is an incomparably more developed environment, and many ways come to mind to do the same thing, but what is the most elegant and cost-effective way to use the same background shared by all the "cards" in a stack? Could you point me to a good example of a LiveCode stack where this is done?
LC is based on HyperCard, which it sounds like you're referring to. But it's not the same. Like Richmond and Craig have already said, "Background" is implemented but it's different.
In LC's case, "background" is an attribute of a group. In other words if you want a set a background that can be shared across cards, you create all the elements as you would do normally and group all the elements into a new group and in its property inspector set the 'background' to true.
For any new cards created from a card that has this background group, this will be included automatically but you can place the background on any card from the Object menu (-> place group). Conversely if you want remove the group from the card don't delete it, or it will delete all instances of the background from all card that have this - instead chose 'remove group' from the Object menu.
It also follows that you can have multiple premade backgrounds that you can pick and choose from for each card and that these are not mutually exclusive (for example I often have a background button/menubar for top of the screen and a different background group for the status bar at the bottom)
You can also use the resizeControl handler to reposition/resize elements of your background group so they will apply to any card/stack size, but that's a bit more advanced...
Re: background and foreground
Posted: Sun Dec 24, 2023 12:42 pm
by richmond62
If you download my sample stack you will see it has 3 cards, all of which share the same background: the group consisting of only the photo of the deer.
I have given each card a different
backGroundColor so, on button clicks, the seperate cards are easy to see.
Yes: odd as it may see, one can have a
group that contains only one member.

Re: background and foreground
Posted: Sun Dec 24, 2023 12:48 pm
by richmond62
well, surely no one remembers it
Very, very hard to forget it: after BASIC, FORTRAN, PASCAL and ZILOG the Mac GUI and HyperCard were,
-
-
quite literally, a mystical experience to me in 1993.
-
-
Without HyperCard there might not be the type of web-browsers we now have, and there certainly would not be SuperCard, LiveCode, or OpenXTalk.
However, just as most Americans, Canadians, Australians, New Zealanders, English and Scots people (OK, OK: and the Welsh and the Irish) do most definitely not speak Shakespearean English (God, Wot, quoth he in a moment of mirth), so SuperCard, LiveCode, and OpenXTalk do not 'speak' HyperTalk (the programming language inwith HyperCard), they speak modern dialects of HyperTalk, with, in addition to some lexical and semantic changes, increased lexica.
Re: background and foreground
Posted: Sun Dec 24, 2023 1:19 pm
by danielrr
richmond62 wrote: ↑Sat Dec 23, 2023 9:39 pm
Here's a very simple example I just made:
-
Screenshot 2023-12-23 at 22.18.44.jpg
Just perfect, thanks!
Re: background and foreground
Posted: Sun Dec 24, 2023 1:21 pm
by danielrr
stam wrote: ↑Sun Dec 24, 2023 1:03 am
danielrr wrote: ↑Sat Dec 23, 2023 9:00 pm
Naturally, LiveCode is an incomparably more developed environment, and many ways come to mind to do the same thing, but what is the most elegant and cost-effective way to use the same background shared by all the "cards" in a stack? Could you point me to a good example of a LiveCode stack where this is done?
LC is based on HyperCard, which it sounds like you're referring to. But it's not the same. Like Richmond and Craig have already said, "Background" is implemented but it's different.
In LC's case, "background" is an attribute of a group. In other words if you want a set a background that can be shared across cards, you create all the elements as you would do normally and group all the elements into a new group and in its property inspector set the 'background' to true.
For any new cards created from a card that has this background group, this will be included automatically but you can place the background on any card from the Object menu (-> place group). Conversely if you want remove the group from the card don't delete it, or it will delete all instances of the background from all card that have this - instead chose 'remove group' from the Object menu.
It also follows that you can have multiple premade backgrounds that you can pick and choose from for each card and that these are not mutually exclusive (for example I often have a background button/menubar for top of the screen and a different background group for the status bar at the bottom)
You can also use the resizeControl handler to reposition/resize elements of your background group so they will apply to any card/stack size, but that's a bit more advanced...
Thanks again to DumbarX (by the nth time) and Stem by their clear clarification of concepts I hadn't fully grasped yet
Re: background and foreground
Posted: Sun Dec 24, 2023 1:29 pm
by richmond62
DumbarX (by the nth time) and Stem
Who are they?
Funnily enough, most people spell my name wrongly and get those 2 right.

Re: background and foreground
Posted: Sun Dec 24, 2023 5:09 pm
by dunbarx
Richard.
He said "Stem". Possibly autoCorrect, but is that any excuse?
Dumbarx
Re: background and foreground
Posted: Sun Dec 24, 2023 5:39 pm
by richmond62
Dear DumbarX and Stem, I wish you all the best this Christmas.
Your's aye, Richard.
Re: background and foreground
Posted: Sun Dec 24, 2023 6:27 pm
by danielrr
richmond62 wrote: ↑Sun Dec 24, 2023 5:39 pm
Dear DumbarX and Stem, I wish you all the best this Christmas.
Your's aye, Richard.
I meant Stam. Don't be tough on me this time of the year Richmond

Re: background and foreground
Posted: Sun Dec 24, 2023 7:30 pm
by jacque
DumbarX and Stem
I LOVE this. Sounds like a comedy team. They should go on the road.

Re: background and foreground
Posted: Sun Dec 24, 2023 7:35 pm
by stam
Trust me, with a Greek name like mine I’ve been called worse
