Change icon in command data

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 10/06/2011 at 08:46, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   12 
Platform:   Windows  ;   Mac OSX  ; 
Language(s) :     C++  ;

---------
hello i have a command data plugin and i need to if command id pressed to change the icon in menu and tool bar.

i registered an icon with a plugin id and i use MSG_GETCUSTOMICON in command message but it wont work here some code:

virtual Bool Message(LONG type, void* data)
     {
          BaseContainer * bc = SpeedMudSh::GetSpeedMudContainer(GetActiveDocument());
          if (!bc) return FALSE;
          LONG mode = bc->GetLong(ID_COORDMODE);
          if (type == MSG_GETCUSTOMICON)
          {
                    if (mode == COORDMODE_ABSOLUTE)
                    {
                         GetCustomIconData *icon =((GetCustomIconData* )data);
                         if (!GetIcon(ICON_WORLD,icon->dat)) GePrint("geticon error!");
                         icon->filled=TRUE;
                         return TRUE;
                    }
          }
          return TRUE;
     }

Bool RegisterCoorSpaceCommand(void)
{
     String name="Coordinate Space"; if (!name.Content()) return TRUE;
     
     Filename fn = GeGetPluginPath()+"res"+"coord_world.tif";
     AutoAlloc<BaseBitmap> bmp;
     if (IMAGERESULT_OK!=bmp->Init(fn)) return FALSE;
     
     RegisterIcon(ICON_WORLD,bmp);

return RegisterCommandPlugin(COORD_SPACE_COMMAND,name,0,AutoBitmap("coord_rel.tif"),String("Toggle Coordinate Space"),gNew CoorSpaceCommand);
}

any suggestion ?

Thanks
Franz

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 15/06/2011 at 07:11, xxxxxxxx wrote:

It's strange, I can change the bitmap with SetPixel etc. but changing the bitmap pointer or the whole icon data doesn't work. I'll try to find a solution.

cheers,
Matthias

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 15/06/2011 at 13:33, xxxxxxxx wrote:

hello Matthias,
thanks for reply .... i was trying to allocate some basebitmap for each icon and work on that but without any result.... we will see if there are any solution
Thanks
Franz 🙂