Resizing items in a group

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
danrg7
Posts: 10
Joined: Fri May 25, 2007 7:42 pm

Resizing items in a group

Post by danrg7 » Sun Jun 08, 2008 12:51 am

I want to update a certain rectangle graphic (knob) whenever the group resizes. So, in the group script, I wrote a reziseControl method that looks like this:

Code: Select all

on resizeControl
  put the rect of me into grploc
  put the width of me into grpwidth
  put the height of me into grpheight
  
  put (item 1 of grploc) + (grpwidth * .25) into pt1
  put (item 2 of grploc) + (grpheight * .15) into pt2
  put (item 3 of grploc) - (grpwidth * .25) into pt3
  put (item 4 of grploc) - (grpheight * .6) into pt4
  put pt1,pt2,pt3,pt4 into newloc
  set the rect of graphic "knob" to newloc
end resizeControl
The only problem is that the group tries to resize itself after the rectangle inside of it resizes. I tried resetting the group's rectangle back to grploc at the end, but the rectangle inside the group seems to have moved by then. How can I stop the group from changing size when the rectangle resizes?
Dan

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Sun Jun 08, 2008 6:58 am

danrg7, you need to set the lockLoc of the group to true.

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

danrg7
Posts: 10
Joined: Fri May 25, 2007 7:42 pm

Post by danrg7 » Sun Jun 08, 2008 3:57 pm

Thanks! I figured it would be just one little property that I could not find.
Dan

Post Reply

Return to “Talking LiveCode”