place command

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
TomKeane123
Posts: 7
Joined: Sat Jul 06, 2019 10:04 am

place command

Post by TomKeane123 » Sun Jul 21, 2019 9:46 am

I'm new to live code and currently doing to 8APP's course.

I have deleted the navigation bar on all of the cards except the first card and

I'm trying to get it to reappear on some of the other cards.

I did a search on the dictionary for the place command but I'm not sure if I'm following the correct syntax or putting the code in the right place.

on the cards I want the navigation bar displayed on to I put:

on preOpencard
place group "Navigation" onto card "stopwatch"

end preOpencard

but this did not work so I tried it on the stack instead of on the card.

on preOpenstack
place group "Navigation" onto card "stopwatch"

end preOpenstack


this also did not work.

does anyone know how to get the navigation bar to display on cards if it is accidentally deleted?

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: place command

Post by bogs » Sun Jul 21, 2019 10:56 am

As far as I can tell, you have the script correctly written, and you are right in that it does not work as the dictionary apparently says it should.

Maybe someone else knows better how this is supposed to work, I never tried it before. My usual method is to just set the group as a background (which will place it on all new cards), and then delete the group from the cards I don't want it on.
Image

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: place command

Post by dunbarx » Sun Jul 21, 2019 2:38 pm

Hi.

When you navigate to an particular card, if the group "navigation" is not present on that card, LC will throw and error. Try something like this(pseudo):

Code: Select all

on preOpencard
place group "Navigation" of cd "anyCardThatContainsGroupNavigation" onto card "stopwatch"
end preOpencard
Do you see? LC is very literal, and it may not know anything about group "navigation" just because it may exist on a card somewhere else in the stack (or on a card in another stack entirely). It has to have it in hand ON THE CURRENT CARD in order to place it somewhere. But if you give it a pathway to where that group lives, it will happily grab it and place it for you.

Craig

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: place command

Post by Klaus » Sun Jul 21, 2019 2:52 pm

Hi all,
When you navigate to an particular card, if the group "navigation" is not present on that card, LC will throw and error.
exactly, but if you want to address a group that is not on the current card but in the stack use
-> background -> bg

GROUPS are counted relative to the card, BACKGROUNDS relative to the stack, so you should script something like:

Code: Select all

on preOpencard
   if there is not a grp "Navigation" then
     place BG "Navigation" onto this card
   end if
end preOpencard
Best

Klaus

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7389
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: place command

Post by jacque » Sun Jul 21, 2019 5:04 pm

Also, the place command is permanent and only needs to be done once during development, so you don't need it a preopencard handler. It won't hurt anything but it's redundant.

After it's run once and all the cards have the background in place you can remove it from the script.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: place command

Post by dunbarx » Sun Jul 21, 2019 11:21 pm

I think what Jacque implies, is that once a group with backGround behavior is in place, any new card will automatically contain it. This is usually an expedient.

Craig

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7389
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: place command

Post by jacque » Sun Jul 21, 2019 11:41 pm

dunbarx wrote:
Sun Jul 21, 2019 11:21 pm
I think what Jacque implies, is that once a group with backGround behavior is in place, any new card will automatically contain it. This is usually an expedient.
That's true, but actually I was referring to how the preOpenCard handler would try to place the group every time the card opens, which isn't really necessary if it's already there. Klaus' example checks for the background group before placing it, but even that is only necessary during development.

It doesn't really hurt anything regardless.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply