Forums > Dev

notify question


Lee
July 31, 2013 | 1:21 pm

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!


July 31, 2013 | 11:03 pm

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: http://cycling74.com/forums/topic/notify-when-attribute-changes/

Hope this helps

- Luigi



Lee
August 1, 2013 | 3:44 am

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…


August 1, 2013 | 4:45 am

@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
August 1, 2013 | 5:09 am

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

Lee


August 1, 2013 | 5:36 am

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
August 2, 2013 | 6:00 am

Thanks Tim


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