[Solved] Moving group problem

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
bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

[Solved] Moving group problem

Post by bogs » Tue Nov 21, 2017 11:12 pm

I thought I understood groups, and the path, but apparently no so much.

I have a group of images I have been using in a project on a subStack. I had later decided (but of course, not before assigning all the images over a LOT of cards of the mainStack) to put the group on a card in the mainStack. I am finding this to be more difficult than I thought initially. Some mistakes in my assumptions were -
. I thought a 'shared' group, no matter its location, was shared throughout the project so that, lets say you copied or cut the group, then pasted it, the items inside would retain their ID. Turns out this is incorrect.
. I thought that a shared group, even on a substack, would still follow the message path of card -> substack -> mainstack (it does, kinda, if I assign a button icon by id of the group, it works), but I am unable to use the place command to place the group on a card in the mainstack.
. I thought I should be able to drag the card the group is on from the substack to the mainstack without changing the IDs, but this is also incorrect.

I am really not looking forward to actually going through each of the cards and manually changing the icon IDs for each button, but that is where I am at at the moment, so in desperation. and after many searches for what I am missing, I am reaching out to see if anyone has a suggestion or method to move a shared group from a card in a substack to the mainstack without changing the IDs of all the images in the group, or alternately, an explanation of why something that seems so simple actually is not :| (See Craig, my brother, your not the only one that comes up with these lu-lu things :D )
Last edited by bogs on Mon Nov 27, 2017 9:04 pm, edited 2 times in total.
Image

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9645
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Moving group problem

Post by dunbarx » Wed Nov 22, 2017 1:13 am

Bogs.

Sharing is within a stack or substack. It follows the HC paradigm, somewhat, of an actual distinct object class, lying between the card and the stack. As such, it does not know or care about other stacks or substacks.

As such again, your
follow the message path of card -> substack -> mainstack
needs to place the shared (backGround behavior set) group between the card and the stack.
I thought I should be able to drag the card the group is on from the substack to the mainstack
Um, nope. You can copy cards from one place to another, though.


Craig Newman

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

Re: Moving group problem

Post by bogs » Wed Nov 22, 2017 3:30 am

dunbarx wrote:
Wed Nov 22, 2017 1:13 am
Sharing is within a stack or substack. It follows the HC paradigm, somewhat, of an actual distinct object class, lying between the card and the stack. As such, it does not know or care about other stacks or substacks.
Yah, that is pretty much the wall I'm running into now. Sure makes me wish I had spent more time playing with Hypercard when it had come out.
You can copy cards from one place to another, though.
Yes, I can even copy the group from one stack to the other. I can understand it changing the picture IDs on copy, since there is now 2 of the same picture. The thing that stump(s) me though, is that even if I cut the pictures and then paste them, the IDs still change! I mean, that should be a one to one replacement, shouldn't it ? I have to admit, I am having a hard time understanding that one :(
Image

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9645
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Moving group problem

Post by dunbarx » Wed Nov 22, 2017 3:36 am

Someone like Jacque or Klaus will know better, But I think in any single session, deleting a control also sets its ID aside so It cannot be used again.

I might be wrong about that.

Craig

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7228
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Moving group problem

Post by jacque » Wed Nov 22, 2017 5:25 pm

I am reaching out to see if anyone has a suggestion or method to move a shared group from a card in a substack to the mainstack without changing the IDs of all the images in the group, or alternately, an explanation of why something that seems so simple actually is not
Every stack maintains its own set of IDs. It has to, because pasting in a control could easily have the same ID as another existing control in the target stack. That would create ID conflicts and some very unexpected results.

LC maintains a list of reserved icon IDs (I think it's in the icon entry in the dictionary) and if you want to share icons across many stacks it's wise to assign the images very high IDs that are unlikely to be used elsewhere. Store the images somewhere in the mainstack (an unused card, an unplaced group, etc). Then you can assign those icons to the controls in the group and they should be found when you copy the group elsewhere, provided the containing stack is in the search path. I generally start my custom ID numbers at 300,000.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7228
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Moving group problem

Post by jacque » Wed Nov 22, 2017 5:39 pm

dunbarx wrote:
Wed Nov 22, 2017 3:36 am
Someone like Jacque or Klaus will know better, But I think in any single session, deleting a control also sets its ID aside so It cannot be used again.

I might be wrong about that.
That's right, but it isn't just for the session, it's forever. IDs are used once per stack. When they're gone, they're gone.

Every stack starts with an ID of 1001 and counts up from there. BTW, if you renumber IDs as I suggested, the IDs for any new controls will begin counting up from there. IDs only march forward.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

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

Re: Moving group problem

Post by bogs » Wed Nov 22, 2017 6:50 pm

Thank you both so much for correcting my profound lack of understanding, now at least I get it, and I am sure I will not forget it.
Image

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”