Cycle Buttons [SOLVED]

On 02/08/2014 at 07:13, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   14, 15 
Platform:   Windows  ;   
Language(s) :     C++  ;

---------
I am having trouble getting cycle buttons to work in a generator plugin. 
This is what I added in the res file

	        LONG MYOBJECT_CYCLE
	        {
	            CYCLE
	            {
	                CYCLE_ITEM_1;
	                CYCLE_ITEM_2;
	                CYCLE_ITEM_3;
	            }
	        }

The cycle list appears fine in the AM. 
The problem is when I am try to access the buttons. This is the code that I am using:

Bool MYOBJECT::Message(GeListNode *node, LONG type, void *data)
{
	switch (type)
	{
		case MSG_DESCRIPTION_COMMAND:
		{
			DescriptionCommand *dc = (DescriptionCommand* ) data;
			if (dc->id[0].id == MYOBJECT_CYCLE)
			{				
				BaseContainer *bc = ((BaseObject* )node)->GetDataInstance();
				if (!bc) return FALSE;
				LONG item = bc->GetLong(MYOBJECT_CYCLE);
				switch (item)
				{
					case CYCLE_ITEM_1:
					GePrint("1");
					break;
  
					case CYCLE_ITEM_2:
					GePrint("2");
					break;
  
					case CYCLE_ITEM_3:
					GePrint("3");
					break;   
  
					default:
					GePrint("default");
					break;
				}
			}
  
		}
  
	}
  
  
return TRUE;
}

Nothing gets printed. If I try to print  dc- >id[0].id I don't get anything.I am presuming that MYOBJECT_CYCLE is not getting recognized in the first place. 
Anyone can shed a light on what I might be doing wrong?

Thanks

On 02/08/2014 at 10:54, xxxxxxxx wrote:

MSG_DESCRIPTION_COMMAND only works with Buttons.  You should check using MSG_DESCRIPTION_CHECKUPDATE.

case MSG_DESCRIPTION_CHECKUPDATE:
	DescriptionCheckUpdate* dcu = static_cast<DescriptionCheckUpdate*>(data);
	if (!dcu)
		return TRUE;
	BaseContainer* bc = op->GetDataInstance();
	if (!bc)
		return TRUE;
	LONG id = (*(dcu->descid))[0].id;
	LONG item = ...
	...

On 02/08/2014 at 11:51, xxxxxxxx wrote:

Works like a charm. Thanks a lot (again) Robert!