[java-dev] getParentPatcher().getPath() does not always work in the constructor
topher lafata
topher at topher.com
Tue Mar 4 09:23:36 MST 2008
- Previous message: [java-dev] getParentPatcher().getPath() does not always work in the constructor
- Next message: [java-dev] Re: getParentPatcher().getPath() does not always work in the constructor
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
seems like a good workaround. i don't know exactly why this happens
but i remember similar behavior when i was working on that stuff. its
like the pointer to the parent patcher isn't initialized until the
entire patcher loads. you could also see if it is valid in the
loadbang() method.
t
On Mar 3, 2008, at 23:45 PM, Adam Murray wrote:
>
> I noticed some inconsistent behavior with getParentPatcher().getPath
> () when used inside a constructor.
>
> When I open the patch for the first time, it will return null. If I
> delete the mxj object and undo, then it will return the correct
> path. It's like the parent patcher doesn't initialize until after
> the mxj object, which seems backwards to me. Is it a bug?
>
> I can work around this problem by using a MaxQelem, which so far
> seems to work flawlessly.
>
>
> import com.cycling74.max.Executable;
> import com.cycling74.max.MaxObject;
> import com.cycling74.max.MaxQelem;
>
> public class test extends MaxObject {
>
> public test() {
> post("path: " + getParentPatcher().getPath());
> initializer.set();
> }
>
> private MaxQelem initializer = new MaxQelem(new Executable() {
> public void execute() {
> post("inside qelem, path: " + getParentPatcher().getPath());
> }
> });
>
> protected void notifyDeleted() {
> initializer.release();
> }
>
> }
>
>
> --
> Adam Murray
> compusition.com
> _______________________________________________
> java-dev mailing list
> java-dev at cycling74.com
> http://www.cycling74.com/mailman/listinfo/java-dev
- Previous message: [java-dev] getParentPatcher().getPath() does not always work in the constructor
- Next message: [java-dev] Re: getParentPatcher().getPath() does not always work in the constructor
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
