Attach and encapsulation ?

Jul 21, 2010 at 10:52am

Attach and encapsulation ?

Hello maxers,

i need my external to get notifications from patcherview ;
everything works fine except while encapsulating it : It seems x->mypatcher change according to the new patcher but x->mypatcherview is set to NULL.

Is there an easy way to keep my external attached after the encapsulate process ?

void *papa_new (t_symbol *s, long argc, t_atom *argv)
   {
       ...
       object_obex_lookup (x, gensym ("#P"), &x->mypatcher) ;
       defer_low (x, (method)papa_attach, NULL, 0, NULL) ;
       ...
   }

void papa_attach (t_papa *x)
   {
       x->mypatcherview = object_attr_getobj (x->mypatcher, gensym ("firstview")) ;
       object_attach_byptr_register (x, x->mypatcherview, CLASS_NOBOX) ;
   }

void papa_notify (t_papa *x, t_symbol *s, t_symbol *msg, void *sender, void *data)
   {
       ...
   }

void papa_free (t_papa *x)
   {
       if (x->mypatcherview)
           {
	        object_detach_byptr (x, x->mypatcherview) ;
	   }
    }

Thanks.

#51424
Jul 21, 2010 at 2:23pm

Hello maxers,

A [papa] external zipped to illustrate the question ; create a new object [papa] ; it’s bind to the patcherview ; encapsulate it … patcherview is NULL and it’s not bind to the new window.

Thanks.

Attachments:
  1. encapsulate.zip
#184387

You must be logged in to reply to this topic.