Moving an object in presentation mode

Lee's icon

Hi, i'm playing around with moving objects at the moment...

I can quite happily use the rect property of a MaxObj to set the location in a patcher, but this has no effect if the patcher is in presentation mode...
Is there a different call to make?

thx Lee

broc's icon

Yes, there are different messages: 'patching_rect' and 'presentation_rect'.

In the inspector click the attribute button @ (bottom left) to see the message names.

Lee's icon

Hi, thx for reply - that's a really useful thing to know - never clicked that before :)

Still having issues tho: This is a snippet of the code:

        var selector = this.patcher.parentpatcher.getnamed( 'track_selector' );

        trace( "parent: " + this.patcher.parentpatcher.name );

        if ( selector ) {
            trace( "selector: " + selector.varname );

            trace( "location: " + selector.rect );

            var loc = selector.rect;

            loc[ 0 ] += flag ? 100 : -100;
            loc[ 2 ] += flag ? 100 : -100;

            selector.rect = loc;

            trace( "newloc1: " + loc );
            trace( "newloc2: " + selector.rect );
        }

This works fine to move an object in the patcher, even tho I'm using rect and not patcher_rect... if i try replacing rect with patcher_rect or presentation_rect then I just get errors....

The varname returns the expected value...

Lee's icon

I've played around a bit more and the above code works with presentation_rect for objects that aren't bpatchers, could this be a bug? If i can change the position of objects using this method, I would expect it to work on a bpatcher also....??