Page 1 of 1

Dinamically changing a group content/scrolable area

Posted: Sat May 18, 2013 3:00 pm
by palanolho
Greetings everyone.

I'm starting to give my first steps on LiveCode so, i'm trying to create my first real application.

I'm my application I have a content area were (later) will drag and drop "items" on it.
For this content area i'm using an group with an graphic as background to define the "content area" (which is bigger than the view area, that's why I'm using a group)

The graphic as a background is what define the area where the user may place the "items". So, the bigger the background graphic, the bigger the areal will be. So, if I need more or less content area, i simple increase/decrease this background graphic and the area will change accordingly (at least it's my idea to deal with this feature. If anyone knows a better way to do it, I'm all ears :D)

When i increase or reduce this graphic size, its grows/shrinks from the centre to the sides. sometimes this is good but other times may not be.
My first question is: is there any way to increase an object size only to the left or right or to the top or bottom?

Another "problem" I'm having is that, I'm able to reduce the bg graphic to a size smaller them the area occupied by all other "items" inside the group.
My second question is: is there any way to control the resize of my background graphic so that the minimum bg size is the area occupied by all other object in that group? how can I achieve that?

Many thanks in advance for any help anyone can provide

Cheers,
- Miguel

Re: Dinamically changing a group content/scrolable area

Posted: Sat May 18, 2013 8:40 pm
by BvG
For resizing objects via scripts, there are many properties that often double each other's functionality, or at least interact in some way. Here's some example properties that you should look up in the dictionary:

left
right
top
bottom
width
height
rectangle
position
topleft
bottomleft
bottomright
bottomleft

so for example to resize a group you could set it's rectangle to make it move towards the bottom right when you increase it:

Code: Select all

--group rectangle is 100,100,200,200
set the rectangle of group 1 to 100,100,250,250
or you could set it's width, but remember it's topleft:

Code: Select all

--group rectangle is 100,100,200,200
put the topleft of group 1 into rememberedValue
set the width of group 1 to 150
set the height of group 1 to 150
set the topleft of group 1 to rememberedValue