I know this has been discussed before but I haven't been able to find an answer!!
The problem:
I have an app designed in a fairly traditional way - main stack simply appears as a splash screen but holds most of the functions & commands for the app as well as the app's menu bar. Users then work on stack files as files they can create/save etc.
Each stack file can have numerous cards and each card has a group called "dropper" that handles the drag drop event and allows the user to drag a variety of things onto the page - e.g. links to files, text snippets, images. On dropping an item, the code creates a new object within Group "dropper". This might be an image, a field or another group.
selectgroupedcontrols is true for group "dropper" to allow the user to manipulate objects they have dragged onto the page but is false for any group created WITHIN group "dropper" as these need to behave as single entities.
I want to allow the user to change the layer of the objects within group "dropper".
There appear to be two approaches to this:
1) set the relayerGroupedControls to true - which works fine until you have groups within the group you're editing. I find changing the layer of an object regularly results in it being merged into one of the groups within group "dropper" rather than being repositioned with respect to its layer IN group "dropper"
2) start editing group "dropper" - this seems the safest approach as it only "sees" the objects in the group and their respective layers. Indeed, if I execute my "Move forwards" script from a button on the card currently being worked on, the code works fine. However, when the same code is executed from the app's menubar it constantly throws an error about the object/background not being found. So my question is "How do you reference an object when editing its owner group".
The code goes like this:
start editing group "dropper" of card ID cID of stack tTop
set the layer of control ID tselobjID to currentvalue+1
(where tselobjID is the ID of the object selected and currentvalue is the current layer value for the object)
As I've said, this code works when executed from the card containing group "dropper" but NOT when executed from the app's menubar. I've tried all sorts of ways of referencing the object - including being specific about the card ID and the stack name - all of which work fine until you "Start editing group "dropper"" - at which point the point of reference for LiveCode I guess changes to just be the contents of the group but I can't find anyway of then referencing the object!!!!
Any advice gratefully received!
Stan
The problem:
I have an app designed in a fairly traditional way - main stack simply appears as a splash screen but holds most of the functions & commands for the app as well as the app's menu bar. Users then work on stack files as files they can create/save etc.
Each stack file can have numerous cards and each card has a group called "dropper" that handles the drag drop event and allows the user to drag a variety of things onto the page - e.g. links to files, text snippets, images. On dropping an item, the code creates a new object within Group "dropper". This might be an image, a field or another group.
selectgroupedcontrols is true for group "dropper" to allow the user to manipulate objects they have dragged onto the page but is false for any group created WITHIN group "dropper" as these need to behave as single entities.
I want to allow the user to change the layer of the objects within group "dropper".
There appear to be two approaches to this:
1) set the relayerGroupedControls to true - which works fine until you have groups within the group you're editing. I find changing the layer of an object regularly results in it being merged into one of the groups within group "dropper" rather than being repositioned with respect to its layer IN group "dropper"
2) start editing group "dropper" - this seems the safest approach as it only "sees" the objects in the group and their respective layers. Indeed, if I execute my "Move forwards" script from a button on the card currently being worked on, the code works fine. However, when the same code is executed from the app's menubar it constantly throws an error about the object/background not being found. So my question is "How do you reference an object when editing its owner group".
The code goes like this:
start editing group "dropper" of card ID cID of stack tTop
set the layer of control ID tselobjID to currentvalue+1
(where tselobjID is the ID of the object selected and currentvalue is the current layer value for the object)
As I've said, this code works when executed from the card containing group "dropper" but NOT when executed from the app's menubar. I've tried all sorts of ways of referencing the object - including being specific about the card ID and the stack name - all of which work fine until you "Start editing group "dropper"" - at which point the point of reference for LiveCode I guess changes to just be the contents of the group but I can't find anyway of then referencing the object!!!!
Any advice gratefully received!
Stan
Statistics: Posted by stan — Sat Nov 30, 2024 3:51 pm