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
-
Cheong
- Posts: 30
- Joined: Tue Oct 27, 2015 7:49 am
Post
by Cheong » Fri Nov 13, 2015 3:59 am
Hi readers,
I used this code but then the image's layer is not changing when called.
Here's the code:
Code: Select all
put (((NumberOfObjects-2)*3)+7) into LayerShouldBeAssigned
answer LayerShouldBeAssigned
set the layer of Image "LoadingPOPUP" to LayerShouldBeAssigned
The answer given at the second line of coding is an number. The variable is supposed to work like a number right?
Any solution?
-
dunbarx
- VIP Livecode Opensource Backer

- Posts: 10331
- Joined: Wed May 06, 2009 2:28 pm
Post
by dunbarx » Fri Nov 13, 2015 5:15 am
Hi.
Code looked good so I tried it.
This all works fine for me. I set an initial value of "NumberOfObjects" to 1, but that does not matter. Since the value in line 2 is a number, the layer is properly set in line 3.
What are you seeing? Are you sure you know how layers work?
Craig Newman
-
Cheong
- Posts: 30
- Joined: Tue Oct 27, 2015 7:49 am
Post
by Cheong » Fri Nov 13, 2015 6:56 am
Thanks Craig Newman,
I am seeing that my image in the card doesn't go to the layer I assigned with the code. I know that layers works like this: Higher value of layer means it will be always on top of the other objects layer that have lower value. I look into the application browser, the value of the layer of the image still remain the same after running the code. I used on mouseUp to trigger the code. Also the on mouseUp is assigned to the buttons by sharing behavior.
Hope you know what I meant...
-
Cheong
- Posts: 30
- Joined: Tue Oct 27, 2015 7:49 am
Post
by Cheong » Fri Nov 13, 2015 7:19 am
Oh, I see it now. No matter what layer value you assigned, the layer will be automatically reduced to the highest possible value of layer compared to the others. Thanks.
If i use answer for poping-up the loading notification, can I make it without the "ok" button?
-
dunbarx
- VIP Livecode Opensource Backer

- Posts: 10331
- Joined: Wed May 06, 2009 2:28 pm
Post
by dunbarx » Fri Nov 13, 2015 3:11 pm
Hi.
Oh, I see it now. No matter what layer value you assigned, the layer will be automatically reduced to the highest possible value of layer
I suspected something like that, which is why I asked if you understood how LC manages layers. You cannot have more layers than controls.
Craig
-
Klaus
- Posts: 14199
- Joined: Sat Apr 08, 2006 8:41 am
-
Contact:
Post
by Klaus » Fri Nov 13, 2015 3:16 pm
Yep: Highest layer = number of controls on a card
EDIT:
And yes, the engine takes care of that if we should supply a higher number.
-
Cheong
- Posts: 30
- Joined: Tue Oct 27, 2015 7:49 am
Post
by Cheong » Mon Nov 16, 2015 2:25 am
Well, is there anyway I can make a pop up that is always on top of the card while some controls are being created after the pop up?
-
dunbarx
- VIP Livecode Opensource Backer

- Posts: 10331
- Joined: Wed May 06, 2009 2:28 pm
Post
by dunbarx » Mon Nov 16, 2015 4:11 am
Hi
Well, is there anyway I can make a pop up that is always on top of the card while some controls are being created after the pop up?
Sure, you simply have to manage the layers of the popup and the new controls. LC only offers its default behavior, that new controls take the top layer. So, managing the popup is likely simpler, perhaps by trapping the "new[control]" message, you can explicitly reset the popup layer to the top.
Craig
-
Klaus
- Posts: 14199
- Joined: Sat Apr 08, 2006 8:41 am
-
Contact:
Post
by Klaus » Mon Nov 16, 2015 2:39 pm
Hi Cheong,
Cheong wrote:Well, is there anyway I can make a pop up that is always on top of the card while some controls are being created after the pop up?
if your "popup" is hidden you can do something like this:
...
set the layer of grp "your popup, presuming it's a group" to TOP
show grp "your popup, presuming it's a group"
...
I've been doing this for years
Best
Klaus
-
Cheong
- Posts: 30
- Joined: Tue Oct 27, 2015 7:49 am
Post
by Cheong » Tue Nov 17, 2015 4:52 am
Thank you, Klaus!