Disable CUSTOMGUI_BITMAPBUTTON's?



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

    On 25/10/2012 at 14:45, xxxxxxxx wrote:

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

    ---------
    I've got another strange one.
    With most built in dialog gizmos you can enable and disable them with "Enable( Gizmod ID, 0 )" & "Enable( Gizmod ID, 1 )"
    But I'm having trouble using that on custom Buttons.
    Not only does it not disable the custom buttons.
    But it also has this really strange side effect of disabling the other gizmos in my GeDialog plugin!

    Here's a bit of code stripped out from my plugin:

    Bool myDialog::CreateLayout(void)  
    {  
      
      Bool res = TRUE;  
      res = LoadDialogResource(IDS_RESDIALOG,NULL,0);  
      
      
      //This is an example of creating a custom button with AddCustomGui()  
      GroupBegin(0,BFH_LEFT,2,0,"MySecondGroup",0);  
          {  
              BaseContainer bbc;                             //Create a container to hold our custom button gizmo              
              bbc.SetLong(BITMAPBUTTON_BORDER, BORDER_OUT);  //Make the button style raised so it looks like a button  
              bbc.SetBool(BITMAPBUTTON_BUTTON, TRUE);      
              myButton = (BitmapButtonCustomGui* )AddCustomGui(10001,CUSTOMGUI_BITMAPBUTTON,"MY BUTTON", 0L,80,80,bbc); //Adds the BitmapButton GUI to the dialog  
              bbc.SetLong(BITMAPBUTTON_TOGGLE, TRUE);  
      
              myButton->SetImage(200000000, FALSE); //Adds our custom registered icon using it's ID#...Be sure to get a real ID# from c4dcafe.com. DON'T use this one in your public projects!  
          }  
      GroupEnd();  
      
      return res;  
    }  
      
      
      
    Bool myDialog::Command(LONG id,const BaseContainer &msg)  //This is where the code that does something goes  
    {  
      BaseDocument *doc = GetActiveDocument(); //Get the active document  
      
      AutoAlloc<BaseBitmap> myicon;  
      IconData idata;                    //Create an IconData type variable to hold our custom registered icon's ID#  
      idata.w = myicon->GetBw();         //Get the width of the Icon if needed later on  
      idata.h = myicon->GetBh();         //Get the height of the Icon if needed later on  
      
      GetIcon(200000000,&idata);        //Get our custom registered icon. The ID# is set up in the "RegistermyResDialog(void)" function  
      GetCustomIconData *myIconData =((GetCustomIconData* )&idata); //Create a CustomIconData type variable called "myicon"      
      myIconData->filled=TRUE;          //Tells C4D that the state of the icon is "filled"  
      
      
      switch (id)   
      {  
        case 10001:  
          Enable( 10001, 0 ); //<--Does not work!? It also hides many of my other gizmos too!!!?  
          break;  
      }  
      
      EventAdd();  
      
      return TRUE;  
    }
    

    How do we enable/disable CUSTOMGUI_BITMAPBUTTON's?

    -ScottA



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

    On 26/10/2012 at 02:19, xxxxxxxx wrote:

    Hi,

    I tested this and the bitmap button's is disabled as expected.
    Have you checked that the bitmap button's ID is unique?



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

    On 26/10/2012 at 08:29, xxxxxxxx wrote:

    Weird.
    I changed the ID from 10001 to 50001 and now it works properly!?
    Up until trying to disable the button. The plugin has worked just fine.
    It's strange that all of this time I never had any ID collision problems with it.
    Can you please remind me what the recommended ID# range is that we should use for or gizmos?

    And just to double check myself.
    We are allowed to the use the same ID's in multiple plugins right?
    If I have a plugin with a gizmo ID# 50001. Is it OK to have another plugin on my system that also uses the same ID#?

    I was under the impression that each plugin is self contained in their own little world. Sort of like each plugin is in it's own unique scope. Which allows us to re-use the same ID#s for our gizmos without clashing with other plugins.

    -ScottA


Log in to reply