Page 1 of 1
Not working: Set image layer by variable
Posted: Fri Nov 13, 2015 3:59 am
by Cheong
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?
Re: Not working: Set image layer by variable
Posted: Fri Nov 13, 2015 5:15 am
by dunbarx
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
Re: Not working: Set image layer by variable
Posted: Fri Nov 13, 2015 6:56 am
by Cheong
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...
Re: Not working: Set image layer by variable
Posted: Fri Nov 13, 2015 7:19 am
by Cheong
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?
Re: Not working: Set image layer by variable
Posted: Fri Nov 13, 2015 3:11 pm
by dunbarx
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
Re: Not working: Set image layer by variable
Posted: Fri Nov 13, 2015 3:16 pm
by Klaus
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.
Re: Not working: Set image layer by variable
Posted: Mon Nov 16, 2015 2:25 am
by Cheong
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?
Re: Not working: Set image layer by variable
Posted: Mon Nov 16, 2015 4:11 am
by dunbarx
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
Re: Not working: Set image layer by variable
Posted: Mon Nov 16, 2015 2:39 pm
by Klaus
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
Re: Not working: Set image layer by variable
Posted: Tue Nov 17, 2015 4:52 am
by Cheong
Thank you, Klaus!