Can LC Copy a group into Scroller group? - Solved

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
DR White
Posts: 718
Joined: Fri Aug 23, 2013 12:29 pm

Can LC Copy a group into Scroller group? - Solved

Post by DR White » Thu May 14, 2020 1:26 pm

Can LC copy a group "ClipBoard_NO" into a specfic location
of a group "lorem" in the scrooler of this
stack with a button?

Small test stack is attached.

Thanks,

David
Attachments
Copy group_Into_group Example.livecode.zip
(4.78 KiB) Downloaded 215 times
Last edited by DR White on Thu May 14, 2020 10:00 pm, edited 1 time in total.

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

Re: Can LC Copy a group into Scroller group?

Post by dunbarx » Thu May 14, 2020 1:54 pm

Hi,

I see this is a new twist on the other thread. Try this in the button script of your sample stack:

Code: Select all

on mouseUp
   clone grp "clipBoard_NO" as "XYZ"
   set the loc of grp "XYZ"  to the loc of grp "scrollArea"
end mouseUp
Now this simply sets the loc of the new group to the loc of the target group. In the other thread I had the feeling that the scroll of the target group was also of importance. Is this still so/

Craig

DR White
Posts: 718
Joined: Fri Aug 23, 2013 12:29 pm

Re: Can LC Copy a group into Scroller group?

Post by DR White » Thu May 14, 2020 2:05 pm

Craig,

The location of the inserted group into the scroller group has to be specific. The inserted groups need to form a rung of
PLC (programmable Logic Controller) code and look something like:

|
|-----| |----------| |-------( )------|

Thanks

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

Re: Can LC Copy a group into Scroller group?

Post by dunbarx » Thu May 14, 2020 2:21 pm

To any others here, note that the construction "last group" still is not supported by LiveCode. The handler:

Code: Select all

on mouseUp
   clone grp "clipBoard_NO" 
   set the loc of last group  to the loc of grp "scrollArea"
end mouseUp
fails, as it always has, because LC does not allow the keyWord "last" to work with groups. It has no issue with any other control. I thought this had been fixed, since this was the first attempt I made for Dr White.

Craig

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

Re: Can LC Copy a group into Scroller group?

Post by dunbarx » Thu May 14, 2020 2:26 pm

The location of the inserted group into the scroller group has to be specific.
I figured as much all along. But you have given no information at all about how those locs are to be set. I had thought that it involved the scroll of the group.

Are successive clones to be stacked somehow? What property of any kind is to be the measure of setting these locs? I just don't have a clue.

Craig

Klaus
Posts: 14194
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Can LC Copy a group into Scroller group?

Post by Klaus » Thu May 14, 2020 2:34 pm

Hi all,

here a workaround:
dunbarx wrote:
Thu May 14, 2020 2:21 pm
To any others here, note that the construction "last group" still is not supported by LiveCode:

Code: Select all

on mouseUp
   clone grp "clipBoard_NO" 
   set the loc of grp (the num of grps) to the loc of grp "scrollArea"
end mouseUp
Best

Klaus

DR White
Posts: 718
Joined: Fri Aug 23, 2013 12:29 pm

Re: Can LC Copy a group into Scroller group?

Post by DR White » Thu May 14, 2020 2:37 pm

The user will scroll to the insertion point and touch the point that the group will be inserted.

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

Re: Can LC Copy a group into Scroller group?

Post by dunbarx » Thu May 14, 2020 3:40 pm

Dr. White.

Aha.
It is your intention that the user clone the group, then scroll, and then click at the desired loc. The clone jumps to the clickLoc.

So are we done if the loc of the last group (which can only be identified with either Klaus' kluge or the naming thing that I wrote about) is set to the clickLoc?

Craig

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7392
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Can LC Copy a group into Scroller group?

Post by jacque » Thu May 14, 2020 3:46 pm

The clone command puts the long name or ID in the "it" variable.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

DR White
Posts: 718
Joined: Fri Aug 23, 2013 12:29 pm

Re: Can LC Copy a group into Scroller group?

Post by DR White » Thu May 14, 2020 3:58 pm

dunbarx wrote:
Thu May 14, 2020 3:40 pm
t is your intention that the user clone the group, then scroll, and then click at the desired loc. The clone jumps to the clickLoc.
Yes.

Why are you using "clone" instead of "copy"?

I don't understand how it would be done.

Could you use the stack that I attached and show me an example?

Thanks
Attachments
Copy group_Into_group Example.livecode.zip
(4.81 KiB) Downloaded 203 times

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

Re: Can LC Copy a group into Scroller group?

Post by dunbarx » Thu May 14, 2020 6:34 pm

Why are you using "clone" instead of "copy"?
Both would work. I used "clone" because that command allows you to name the new, er, copy at creation time.

Put this into the script of group "scrollArea":

Code: Select all

on mouseUp
   put the clickLoc into tLoc
   
   clone grp "clipBoard_NO" as "XYZ"
   set the loc of grp "XYZ"  to  tLoc
end mouseUp
This does not address the "x" value of the final loc of the new group. If you go this route, you will want to manage the successive new names of the new groups. There are likely other tweaks required as well.

Craig

DR White
Posts: 718
Joined: Fri Aug 23, 2013 12:29 pm

Re: Can LC Copy a group into Scroller group?

Post by DR White » Thu May 14, 2020 7:54 pm

Did not work.
After the the group is cloned to location, it dose not scroll with the scroller.
It's like it did not become part of the scrolling group.

DR White
Posts: 718
Joined: Fri Aug 23, 2013 12:29 pm

Re: Can LC Copy a group into Scroller group? - Solved

Post by DR White » Thu May 14, 2020 8:16 pm

Craig and Klaus,

Thanks so much your help. You provided me with the
information to get me to the code below that seems to work.

on mouseUp
put the clickLoc into tLoc
clone grp "clipBoard_NO" as "XYZ"
copy grp "XYZ" to grp "scrollArea"
set loc of grp "XYZ" to tLoc
end mouseUp

The LC Team is the BEST,

David

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

Re: Can LC Copy a group into Scroller group?

Post by dunbarx » Thu May 14, 2020 9:32 pm

David.

Glad you found a way. I did not know about the new group having to scroll after it was created. Know that you can "copy" a control directly into any group. See the dictionary. This will shorten your handler a bit.

Craig

Post Reply