notify question

Lee's icon

CLASS_ATTR_SYM((t_class *)MAX_DeviceIO::m_class, "device_type", 0, MAX_DeviceIO, m_p_device_type );
CLASS_ATTR_ENUM((t_class *)MAX_DeviceIO::m_class, "device_type", 0, "Launchpad Quneo Push Lemur TouchOSC Mira" );
class_addmethod((t_class *)MAX_DeviceIO::m_class, (method)MAX_DeviceIO::notify, "notify", A_CANT, 0);

Hi, I have the above code..

The attribute appears in the inspector as required, with the required enumeration, but I have a couple of issues:
1) instantiating ... '@device_type Launchpad' doesn't have any effect - the autocomplete doesn't show "device_type" as an option as I would expect it to. The inspector shows device_type along with the enumerations I've supplied
2) the notify() method is not called if I send a "device_type Launchpad" into the object

thx for any helpers!

Luigi Castelli's icon

1) Why would you expect the autocomplete to show device_type as an option? You are declaring an attribute (and an attribute of an attribute) for your object. Unless I misunderstand your question, the autocomplete has nothing to do with it.

2) If this is not an UI object you need to attach the object to itself in order to receive notifications. Please, check this thread: https://cycling74.com/forums/notify-when-attribute-changes/

Hope this helps

- Luigi

Lee's icon

thanks for the help guys, will check out later...

@Luigi, I was just thinking maybe that when you registered the attributes that MAX might add them to it's DB for autocomplete...

Luigi Castelli's icon

@Lee, I can tell you that's not the case. However affecting the autocomplete DB might be possible by editing some files in the Cycling74 folder. Obviously you gotta ask C74 for the details on those files because I am pretty much clueless about them.

Cheers

- Luigi

Lee's icon

Hey - not really that bothered, if it happend automatically that'd be great, otherwise np :)

Lee

Timothy Place's icon

The database culls its information from the refpages (the ones ending in .maxref.xml). At the moment there isn't really an official model for this, but you can look at TapTools to see an example ( e.g. https://github.com/tap/TapTools/blob/master/TapTools/docs/tap.comb~.maxref.xml ).

- .. --

Lee's icon

Thanks Tim