ATTR_SET_OPAQUE_USER and attribute style

    Sep 02 2011 | 2:26 pm
    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?

    • Sep 02 2011 | 3:59 pm
      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
    • Sep 03 2011 | 5:17 pm
      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);
    • Sep 05 2011 | 6:04 pm
      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
      - SET_OPAQUE 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)
      - SET_OPAQUE_USER does what it should, disabling setting it from max (with message and inspector)
      - object_attr_setdisabled 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?
      - GET_OPAQUE 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)
    • Sep 05 2011 | 6:06 pm
      @vanille béchamel: well-illustrated, btw, you might like the "onoff' style: CLASS_ATTR_STYLE(c,"attrname", 0, "onoff");