Constraining a group within a group's rectangle

Create fast, sprite powered games with Animation Engine, co-developed with DerBrill Software!

Moderators: heatherlaine, kevinmiller, robinmiller, malte

Post Reply
Bernard
Posts: 351
Joined: Sat Apr 08, 2006 10:14 pm
Location: London, England

Constraining a group within a group's rectangle

Post by Bernard » Sun Jun 21, 2009 2:54 pm

Hi Malte,

I can use ConstrainRectangular to move fields around inside a group of other fields (the rect of these grouped fields constitutes the constraint). However, when I try to make these groups into more complex objects (e.g. a group of a field and 2 graphics), I can't get the constrained group to move. I've taken the ConstrainRectangular property from the field and put it in the group, but the group just won't move. The group's lockLoc is false.

If I put a "grab me" inside a mouseDown of the group, then I can move the group inside the wider group. A mouseUp message goes to the group, but even with nothing but your "Constrain.." handlers inside the group nothing happens. In fact, a breakpoint on "constrainRectangularInit" is never triggered.

Is it that AnimationEngine is not supposed to work with grouped controls, or is there some property I'm missing?

Bernard

malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Location: Ostenfeld germany
Contact:

Post by malte » Sun Jun 21, 2009 6:51 pm

Hi Bernard,

constraining groups is currently not supported. I will look into this for an update, but have to say this is tricky, due to the way the engine handles messages (you will not receive mouseDown in a group, if you click into an empty area for example). If one wants to take nesting into account this is even trickier. As a workaround, try to create a graphic on top of all controls in the group, set its ink to noop and update the locations of all controls in the group. I know this is some sort of pain, however at the moment the only solution I can think of.

Cheers,

Malte

Post Reply

Return to “Animation Engine”