ATTR_SET_OPAQUE_USER and attribute style
I’m puzzling with attributes today
I try to to create a few attributes that the user can see in the inspector, but cannot change, I do that with ATTR_SET_OPAQUE_USER.
I would still like to control how to these attributes are displayed in the inspector. I tried to do to that with: CLASS_ATTR_STYLE_LABEL and another one with CLASS_ATTR_ENUMINDEX.
It seems that as soon I as I set the ATTR_SET_OPAQUE_USER the CLASS_ATTR_STYLE_LABEL and CLASS_ATTR_ENUMINDEX commands are ignored and the attribute is displayed as a number in the inspector.
Is this expected behaviour? if so: is there a workaround?
and related: what does the ATTR_SET_OPAQUE flag do? it seems that I can still set the value in the inspector and from max messages, is that correct?
Thanks, I am also using that, but for attributes that are not ‘active’ at the moment. So I think this has a different use. I also want to know where the other flags are for and how to use them properly..
Still I also have an issue with that and that is that I can still change the attribute with a max messages even though it is set to disabled
Since it’s an opaque attribute is usually not meant to be seen. I can confirm the behavior although it is unlike to change in the foreseeable future.
However, if you set the attribute with the flags bellow it shouldn’t respond to a message:
long flags = ATTR_SET_OPAQUE | ATTR_SET_OPAQUE_USER;
CLASS_ATTR_LONG(c, "yourattr", flags, t_yourobject, somevariable);
Ok that part is now clear emmanuel, thanks
However… I've tried out different flags and attribute settings and I don't fully understand what they do. I included the c-file and a table with my findings, I hope it's clear, let me know if that's not the case
seems to do nothing, it is supposed to disable setting from max and from a c message, but I can still do that (with a message box, or in c with object_attr_setparse for example)
does what it should, disabling setting it from max (with message and inspector)
doesn't seem to do anything but greying out the name, the value is still settable with message, inspector and c method, is that correct?
this removes the message option to set the value, why?
- bonus question:
how can you query an attribute from an object?
is that done with with something like? class_attr_getvalueof? (I only found class_attr_attr_getvalueof)
well-illustrated, btw, you might like the "onoff’ style: CLASS_ATTR_STYLE(c,"attrname", 0, "onoff");