background and foreground
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
background and foreground
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.
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.
-
- Livecode Opensource Backer
- Posts: 9417
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
-
- Livecode Opensource Backer
- Posts: 9417
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: background and foreground
Here's a very simple example I just made:
-
-
- Attachments
-
- back image.livecode.zip
- Stack.
- (249.98 KiB) Downloaded 37 times
-
- VIP Livecode Opensource Backer
- Posts: 9678
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: background and foreground
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
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
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.danielrr wrote: ↑Sat Dec 23, 2023 9:00 pmNaturally, 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?
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...
-
- Livecode Opensource Backer
- Posts: 9417
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: background and foreground
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.
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.
-
- Livecode Opensource Backer
- Posts: 9417
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: background and foreground
Very, very hard to forget it: after BASIC, FORTRAN, PASCAL and ZILOG the Mac GUI and HyperCard were,well, surely no one remembers it
- -
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
Just perfect, thanks!richmond62 wrote: ↑Sat Dec 23, 2023 9:39 pmHere's a very simple example I just made:
-
Screenshot 2023-12-23 at 22.18.44.jpg
Re: background and foreground
Thanks again to DumbarX (by the nth time) and Stem by their clear clarification of concepts I hadn't fully grasped yetstam wrote: ↑Sun Dec 24, 2023 1:03 amLC 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.danielrr wrote: ↑Sat Dec 23, 2023 9:00 pmNaturally, 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?
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...
-
- Livecode Opensource Backer
- Posts: 9417
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: background and foreground
Who are they?DumbarX (by the nth time) and Stem
Funnily enough, most people spell my name wrongly and get those 2 right.
-
- VIP Livecode Opensource Backer
- Posts: 9678
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: background and foreground
Richard.
He said "Stem". Possibly autoCorrect, but is that any excuse?
Dumbarx
He said "Stem". Possibly autoCorrect, but is that any excuse?
Dumbarx
-
- Livecode Opensource Backer
- Posts: 9417
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: background and foreground
Dear DumbarX and Stem, I wish you all the best this Christmas.
Your's aye, Richard.
Your's aye, Richard.
Re: background and foreground
I meant Stam. Don't be tough on me this time of the year Richmondrichmond62 wrote: ↑Sun Dec 24, 2023 5:39 pmDear DumbarX and Stem, I wish you all the best this Christmas.
Your's aye, Richard.
-
- VIP Livecode Opensource Backer
- Posts: 7241
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: background and foreground
I LOVE this. Sounds like a comedy team. They should go on the road.DumbarX and Stem
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: background and foreground
Trust me, with a Greek name like mine I’ve been called worse