Feb 18, 2011 at 5:25pm


Following code fragment:

t_max_err myErr = MAX_ERR_NONE;
tMyObj*	  me = object_alloc(gObjectClass);
Object*	  myPatcher;

post("%s(): try to hide patcher", __func__);
object_obex_lookup(me, gensym("#P"), &myPatcher);
myErr = patcherview_set_visible(jpatcher_get_toppatcher(myPatcher), false);
post("  patcherview_set_visible() returned %ld", myErr);

patcherview_set_visible() Returns -1 (MAX_ERR_GENERIC) and doesn’t hide the main patcher window (which I was hoping to do).

This is called from the object’s instantiation method. (As the call to object_alloc() sort of indicates.-)

gObjectClass is a properly allocated t_class.

Is there any way for an object to hide its top-level patcher (or any patcher)? I also tried jpatcher_set_rect() with an offscreen rect with no love (but it at least returns MAX_ERR_NONE).

In this case I just want to hide the top-level patcher when it’s in a standalone, and only then during initialization. Once initialization is finished it gets put back onscreen. As it is, it gets covered by a splash screen, but there a couple of seconds with the top-level patcher on screen before the splash gets drawn. Any ideas?

I never thought I’d want to do something like this,-

Feb 18, 2011 at 6:45pm


i tried that :

t_object *patcher = NULL ;
object_obex_lookup (x, gensym("#P"), &patcher) ;
patcherview_set_visible (jpatcher_get_firstview (jpatcher_get_toppatcher(patcher)), 0) ;

in a defer_low ( ) function ; and it works … sometimes … and sometimes crash MAX ;-)

  1. flop.c
Feb 18, 2011 at 7:46pm

Right, I hadn’t looked into the patcherview API. But still, if it doesn’t work or crashes that’s sort of a deal breaker;-

Some more research, and it looks like I’ll eventually have to implement one of Ben’s suggestions in <>.

Still it would be nice to have some way to hide a window.

Feb 19, 2011 at 7:11am


in my code patcherview_set_visible crash only with the toppatcher view ; but as that is what you want to do, it’s a pity ;-)

Feb 19, 2011 at 7:51am


a way to do it with patcherview_set_rect ;-)

hope no bug ; no more test : my battery is too low …


Feb 19, 2011 at 10:58am

Hello maxers,

Oops : you get an ugly flashing window if you implement such a thing during the instantiation. Furthermore it seems impossible to save/load a patcher with coordinates outside of screen ; so i give up …

… Ben’s suggestion is best ;-)


You must be logged in to reply to this topic.