add/move/put into to group

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
rinzwind
Posts: 135
Joined: Tue May 01, 2012 10:44 am

add/move/put into to group

Post by rinzwind »

is it possible to move an existing field/button into a new or existing group by code?
The IDE allows you to create a new group for an existing control. But you can't do it in code... as far as I see.
thanks
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2734
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: add/move/put into to group

Post by jmburnod »

Hi rinzwind ,
Yes :D
Something like that :

Code: Select all

on mouseup
   put the id of btn "MyBtnForCopy" into tBtnForCopyID
   copy btn id tBtnForCopyID to group "myGroup"
   delete btn id tBtnForCopyID
end mouseUp
Best regards
Jean-Marc
https://alternatic.ch
Klaus
Posts: 14325
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: add/move/put into to group

Post by Klaus »

HI rinzwind,

check this working script from a little test I just made:

Code: Select all

on mouseUp
   lock screen
   select fld 1
   cut
   start editing grp "g1"
   paste
   stop editing bg "g1"
   unlock screen
end mouseUp
Please note the little difference between "start" and "stop".
The first requires GROUP the latter BACKGROUND!?
Don't ask, no idea :D


Best

Klaus
rinzwind
Posts: 135
Joined: Tue May 01, 2012 10:44 am

Re: add/move/put into to group

Post by rinzwind »

Aah copy and delete. Not as nice as move but its a good workarround. Thanks!
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2734
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: add/move/put into to group

Post by jmburnod »

What about this :

Code: Select all

on mouseup
   put the loc of group "myGroup" into tLocDest
   put the id of btn "MyBtnForCopy" into tBtnForCopyID
   move btn id tBtnForCopyID to tLocDest
   copy btn id tBtnForCopyID to group "myGroup"
   delete btn id tBtnForCopyID
end mouseUp
https://alternatic.ch
Klaus
Posts: 14325
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: add/move/put into to group

Post by Klaus »

rinzwind wrote:Aah copy and delete. Not as nice as move but its a good workarround. Thanks!
My solution come as near to "moving" as possible :D
No deletion neccessary.
Post Reply