Forums > Dev

jbox_set_hidden doesn't work with bpatcher objects

June 6, 2013 | 12:46 pm

Hi,

i am developing a C-external containing the following line:

jbox_set_hidden(mymaxobject ,0);

It should show or hide max objects. This command only works, if mymaxobject is not a bpatcher object. I get the object with

mymaxobject = jbox_get_object(x->found_maxbox)

x->found_maxbox is found through the usual "iterate" procedure.

Is it a bug?

Thanks, Thomas


June 8, 2013 | 1:56 pm

Hi Nicolas,

in fact i wanted to hide/show the bpatcher object itself. In consequence, the bpatcher’s content is also hidden/shown. It works perfectly for normal max objects. But if the obejct is a bpatcher, then it doesn’t work

Here is some more code:

long getnamed_maxbox_iteration(t_myobject *x, t_object *box)
{
t_symbol *foundname = object_attr_getsym(box, gensym("varname"));
if (!strcmp(foundname->s_name,x->findstring)) {
x->found_maxbox = box;
return 0;
}
return 0;
}

t_object *getnamed_maxbox(t_myobject *x, t_object *obj, char *findstring)
{
long result = 0;
x->found_maxbox=NULL;
strcpy(x->findstring,findstring);
object_method(obj, gensym("iterate"), (method)getnamed_maxbox_iteration, x, PI_WANTBOX, &result);
if (x->found_maxbox)
{
return(jbox_get_object(x->found_maxbox));
}
}

and then somewhere i execute

t_object *voice_parameters = getnamed_maxbox(x,x->orchestra_patcher,varname );
jbox_set_hidden(voice_parameters ,offon); //max bug: doesn’t work for bpatchers

Thanks Thomas


June 13, 2013 | 8:15 am

Hi Nicolas,

thank you very much, it works now. For bpatchers and patcher, i had to use

return(x->found_maxbox);

instead of

return(jbox_get_object(x->found_maxbox));

Thomas


Viewing 3 posts - 1 through 3 (of 3 total)