Can LC set an objet to the top laye of a group with script? - Solved
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Can LC set an objet to the top laye of a group with script? - Solved
Can LC set an objet to the top laye of a group with script?
Thanks,
David
Thanks,
David
Last edited by DR White on Mon May 25, 2020 11:52 pm, edited 1 time in total.
Re: Can LC set an objet to the top laye of a group with script?
Hi David
Yes LC can
Something like that:
Best regards
Jean-Marc
Yes LC can
Something like that:
Code: Select all
on setLayerControl pControl,pGroup
put getMaxLayerInGrp(pGroup) into tTopLayerOfGrp
set the relayerGroupedControls to true
relayer control pControl after control tTopLayerOfGrp
set the relayerGroupedControls to false
end setLayerControl
function getMaxLayerInGrp pGroup
put the num of controls of group pGroup into tNbControls
put the short name of control tNbControls of group pGroup into rMaxLayerInGrp
return rMaxLayerInGrp
end getMaxLayerInGrp
Jean-Marc
https://alternatic.ch
-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: Can LC set an objet to the top laye of a group with script?
So . . . I would be inclined to ungroup the group, reorder the objects and then regroup them again.
-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: Can LC set an objet to the top laye of a group with script?
2 lines of code!
Code: Select all
on mouseUp
ungroup group "bunch"
group img "three" and img "two" and img "one"
end mouseUp
- Attachments
-
- ReLayer.livecode.zip
- Here's the stack.
- (8.25 KiB) Downloaded 248 times
Re: Can LC set an objet to the top laye of a group with script?
Thanks for the suggestions.
The group I am working with is in a mobile scroller with more than 40 items in the group,
witch are being inserted by the user. I need to keep my pointer on top of the newly inserted
objects. As a work around, i am currently deleting and copying the pointer after each new object is
inserted to keep the pointer on top. It works OK, but I thought the might be a better way.
Thanks both of you for your help,
David
The group I am working with is in a mobile scroller with more than 40 items in the group,
witch are being inserted by the user. I need to keep my pointer on top of the newly inserted
objects. As a work around, i am currently deleting and copying the pointer after each new object is
inserted to keep the pointer on top. It works OK, but I thought the might be a better way.
Thanks both of you for your help,
David
Re: Can LC set an objet to the top laye of a group with script?
Hi David,
Did you try to adapt scripts i posted to your context ?
Did you try to adapt scripts i posted to your context ?
https://alternatic.ch
Re: Can LC set an objet to the top laye of a group with script?
Richmond.
That was adorable.
David.
But is it necessary to do anything more than:
(You have to do the usual calcs to adjust loc of the card window to screen "0,0".)
This begs whatever method you use adding the newly created control to the group. The only reason I am posting is because the original question was how to "locate" the newly added control, not how to add the control to the group. For example, you could copy the new control to the group, and then delete the original.
Fun stuff...
Craig
That was adorable.
David.
But is it necessary to do anything more than:
Code: Select all
set the screenMouseLoc to the loc of last control
This begs whatever method you use adding the newly created control to the group. The only reason I am posting is because the original question was how to "locate" the newly added control, not how to add the control to the group. For example, you could copy the new control to the group, and then delete the original.
Fun stuff...
Craig
Re: Can LC set an objet to the top laye of a group with script?
Craig,
I don't see how "set the screenMouseLoc to the loc of last control" is going to change a layer property.
Jean-Marc,
I don't understand what "getMaxLayerInGrp(pGroup)" is.
Thanks,
David
I don't see how "set the screenMouseLoc to the loc of last control" is going to change a layer property.
Jean-Marc,
I don't understand what "getMaxLayerInGrp(pGroup)" is.
Thanks,
David
Re: Can LC set an objet to the top laye of a group with script?
David.
You said you wanted to set the pointer to the loc of the most recent control, which is created by the user. My only point was one way to do that. Relayering is not required.
It is is another matter entirely to include that control in the group. If other actions create, say, other controls in other groups, then certainly managing the members of each group is important.
Craig
It doesn't. I guess I misunderstand what you are trying to do.I don't see how "set the screenMouseLoc to the loc of last control" is going to change a layer property.
You said you wanted to set the pointer to the loc of the most recent control, which is created by the user. My only point was one way to do that. Relayering is not required.
It is is another matter entirely to include that control in the group. If other actions create, say, other controls in other groups, then certainly managing the members of each group is important.
Craig
-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: Can LC set an objet to the top laye of a group with script?
You could have a list field where each line contains the name of an object within a group:
new ones being added at the start of the list.
Then you could have a script that set the object in line 1 of your list to the top layer inside your group.
new ones being added at the start of the list.
Then you could have a script that set the object in line 1 of your list to the top layer inside your group.
Re: Can LC set an objet to the top laye of a group with script?
Thanks everyone for all the good suggestions, but they seem like too much work.
I think I will just keep deleting the pointer group and then coping it back after
new control is copied to keep it on top layer.
I think I will just keep deleting the pointer group and then coping it back after
new control is copied to keep it on top layer.
Re: Can LC set an objet to the top laye of a group with script?
Ahem...
A closer look at RELAYER in the dictionary will show you that you can
(or to back, to put it to the lowest layer of the group)
You can deal with nesting of groups by including "the owner" as a self-referencewill set the layer to the topmost layer of the group it is in, without bleeding into any other nested groups.
A bit more discussion is here: https://forums.livecode.com/viewtopic.php?f=9&t=31153
A closer look at RELAYER in the dictionary will show you that you can
Code: Select all
relayer <objectref> to front of group <groupref>
You can deal with nesting of groups by including "the owner" as a self-reference
Code: Select all
relay me to front of the owner of me
A bit more discussion is here: https://forums.livecode.com/viewtopic.php?f=9&t=31153
Re: Can LC set an objet to the top laye of a group with script?
SparkOut,
WOW!
The code "relayer <objectref> to front of group <groupref>" works Great!
Thanks SO MUCH,
David
WOW!
The code "relayer <objectref> to front of group <groupref>" works Great!
Thanks SO MUCH,
David