Set group rect to its child contents
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Set group rect to its child contents
I'll start by saying the solution to my problem is solved by toggling the "Clip child controls to rect" checkbox in the Property Inspector. Unfortunately I don't recall if we can actually see the code behind the the various IDE elements in LiveCode.
So here's the problem:
I have a group with random elements within it. At some point the rect of the group is getting modified which causes the rect to clip its content somewhat.
I'm trying to find a way to *reset* the group's bounds/rect to that of its contents so that the groups border perfectly matches the rect of all its contents. "Clip child controls to rect" does this perfectly, but I need it to work in script.
Simon
So here's the problem:
I have a group with random elements within it. At some point the rect of the group is getting modified which causes the rect to clip its content somewhat.
I'm trying to find a way to *reset* the group's bounds/rect to that of its contents so that the groups border perfectly matches the rect of all its contents. "Clip child controls to rect" does this perfectly, but I need it to work in script.
Simon
Re: Set group rect to its child contents
HA! Managed to find the answer in a 2017 mailing list.
set the clipsToRect of group "Canvas" to false
set the clipsToRect of group "Canvas" to false
-
- VIP Livecode Opensource Backer
- Posts: 7258
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Set group rect to its child contents
You said you want the group to enclose it's contents, but clipsToRect will cut off any controls that exceed the boundaries. Is that the goal? If not, you might want to look at formattedHeight and formattedWidth.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Set group rect to its child contents
Hi Jacque,
yes, for the moment I need it to act as a clip as the group itself is acting like a canvas of sorts. Anything outside those bounds is "off canvas".
But thanks for the info about the formattedHeight and formattedWidth, I'm sure I'll need those too as I progress through this project.
yes, for the moment I need it to act as a clip as the group itself is acting like a canvas of sorts. Anything outside those bounds is "off canvas".
But thanks for the info about the formattedHeight and formattedWidth, I'm sure I'll need those too as I progress through this project.
-
- VIP Livecode Opensource Backer
- Posts: 9857
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Set group rect to its child contents
For creating a canvas you may also find the boundingRect group property useful.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Set group rect to its child contents
Thanks Richard, the boundingRect actually works very well.
-
- VIP Livecode Opensource Backer
- Posts: 9857
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Set group rect to its child contents
Glad you like it. I co-invented it brainstorming with Scott Raney back in the old MetaCard days, as a way to provide an LC-savvy way to get something like SuperCard's backsize property.
I haven't used boundingRect often, but it's very handy when creating certain document UIs that need a canvas of a fixed size. I'll probably be using it again shortly, now that I'm making some print-oriented tools for board game design.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn