Copy to Group problems
Bob Sneidar
bobs at twft.com
Fri Jan 13 17:47:47 EST 2012
Another possibility is to make sure none of your groups have "group" as a part of the short name (they do by default) and then check to see if any new group you *think* you have created is actually the one you want by making sure it's short name begins with the word "group". If not, loop through all the groups on a card until you find the new group. It's convoluted, but that should ensure that what you think you see is what you end up with.
Bob
On Jan 13, 2012, at 1:47 PM, Pete wrote:
> Not sure if you'll classify this as "help" but I've had problems in the
> past referring to "the last group" not returning what I considered to be
> the last group, although I can't explain what you see in your answer
> commands.
>
> The dictionary doesn't mention if the copy command returns the id of the
> copied control in the it variable - if it does, you could use that to refer
> to the newly copied group.
>
> I believe I ended up using the create command instead of copy, which does
> return the id in the it variable, and then making all my adjustments by
> referring to it.
>
> Good luck!
>
> On Fri, Jan 13, 2012 at 12:55 PM, user <alanira9 at mac.com> wrote:
>
>> Hi everyone,
>>
>> I have a script intended to add, name and position a label and field group
>> (which I refer to as a "doublet) into a group that already has a number of
>> such doublet groups.
>>
>> Here's the script:
>>
>> on addFldDoublet theGroup
>> put the number of grps in grp theGroup into lastDoublet
>> put the short name of grp lastDoublet of grp theGroup into lastName
>> put the left of grp lastName into newLeft
>> put (the bottom of grp lastName +2) into newTop
>> put lastName into nextName
>> set itemDelimiter to "_"
>> add 10 to last item of nextName
>> set itemDelimiter to ","
>> copy grp lastName to grp theGroup
>> set the name of the last grp to nextName
>> answer the short name of the last grp -- confirms the correct name
>> put the short name of the last grp into newGrp
>> answer newGrp -- confirms the correct name
>> set the left of grp newGrp to newLeft
>> set the top of grp newGrp to newTop
>> end addFldDoublet
>>
>> FYI - assume the name of grp lastDoublet is "DB_Doublet_160"
>>
>> Group newGrp is supposed to be "DB_Doublet_170" and this appears to be
>> confirmed by the two "answer" commands I've inserted in the script to
>> verify.
>>
>> But after the script runs, it turns out that the new group is also named
>> "DB_Doublet_160" instead of "DB_Doublet_170" (which does not seem to exist,
>> even though the second "answer" test shows that it did ), and the new group
>> is positioned right on top of the old group, and not offset to to newTop as
>> desired (2 pixels below the bottom of the old group.
>>
>> Anybody have any idea as to what is causing this script to not work as
>> intended?
>>
>> Thanks in advance for your help in this matter.
>>
>> Kind regards,
>> ALAN GAYNE
>>
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>>
>
>
> --
> Pete
> Molly's Revenge <http://www.mollysrevenge.com>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list