Position object under group created through script after cd was opened

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
JereMiami
Posts: 127
Joined: Mon Nov 03, 2014 12:17 am

Position object under group created through script after cd was opened

Post by JereMiami » Sat Dec 07, 2019 4:12 am

Hey all!

I am trying to position an object directly underneath a group, where the group was created after the card was opened through script. The object seems to be unable to find the group. Is this because it was it was created after the card was opened? Is there something I need to do to have that object find that group?

--
set the bottom of x to the bottom of grp "y"" -- y is a copy of a group that was created after the card was opened.
--
Many thanks in advance!
J.

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Position object under group created through script after cd was opened

Post by jmburnod » Sat Dec 07, 2019 10:56 am

Hi,
I see a double quote in the grp name ("y"")
What do you have in x variable, a control name ?

After you posted 10 messages you will may upload your stack and that will be easier for us to help you.
Best regards
Jean-Marc
https://alternatic.ch

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

Re: Position object under group created through script after cd was opened

Post by dunbarx » Sun Dec 08, 2019 3:24 pm

Hi.

Not sure how you are doing this, but try an experiment. Create a new stack. make a button with this in its script:

Code: Select all

on mouseUp
   create card
   create button
   set the top of btn 1 to 400
   create field
   set the top of fld 1 to the bottom of btn 1
end mouseUp
Click on the button.

You have created a new card and new controls, and though not overlaid, which is trivial, all is well. Do I have the sequence correct?

Craig

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10097
Joined: Fri Feb 19, 2010 10:17 am

Re: Position object under group created through script after cd was opened

Post by richmond62 » Sun Dec 08, 2019 3:56 pm

Do you mean:

at a lower layer on the card than the group

or

positioned lower down the card than the group

when you say,

"Position object under group" (my bolding) ?

SparkOut
Posts: 2944
Joined: Sun Sep 23, 2007 4:58 pm

Re: Position object under group created through script after cd was opened

Post by SparkOut » Sun Dec 08, 2019 7:02 pm

There are lots of things that *could* be the cause of your problem, but we can't tell for sure what it might be without seeing more of your actual code that creates the group.
One other "speculation" is the one line you showed above

Code: Select all

set the bottom of x to the bottom of grp "y"
looks like the error *might* not be in finding the new group "y" but deciding what "x" is. As you have it, LiveCode will first try to interpret x as a variable, since it is not a quoted literal, and does not have an object identifier. Did you maybe? mean something like

Code: Select all

set the bottom of field "x" to the bottom of grp "y"
In any event, seeing a bit more of your script would help to find the solution.

Post Reply