Hide/Unhide GeDialog Gizmos?



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

    On 06/11/2012 at 12:48, xxxxxxxx wrote:

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

    ---------
    I'm trying to hide/unhide gizmos in a GeDialog. But once they are hidden I can't manage to bring them back again.

    Here's my button code that calls the hide/unhide for a gizmo
    Hide works fine. But the unhide code does not work:

        switch (id)   
      {  
          case MY_BUTTON_HIDE:  
              HideElement(MY_GIZMO, TRUE);       //Tell C4D to hide this gizmo  
              LayoutFlushGroup(GIMO_GROUP_ID);   //Redraw the gizmo's group reflecting the changes  
              LayoutChanged(GIMO_GROUP_ID);      //Tell C4D the GeDialog has changed  
              break;  
      
          case MY_BUTTON_UNHIDE:  
              HideElement(MY_GIZMO, FALSE);  
              LayoutFlushGroup(GIMO_GROUP_ID);  //<--This code block does not bring the gizmo back!?  
              LayoutChanged(GIMO_GROUP_ID);  
              break;  
      }
    

    Do I need to use a gadget *ptr for this?
    The docs show an example how to create a gadget ptr

    C4DGadget* ptr = dlg.AddStaticText(123, ...); // Generates GadgetPtr(123)
    

    Which I'm assuming is placed inside the CreateLayout() method?
    But then I'm unclear how to actually use this new ptr.

    Normally I would create a ptr like this as a class member variable so it's available for use in all the methods in my plugin. But the way it's written in the docs it appears to be created as a local CreateLayout() variable.
    So I don't know how to actually use that ptr in my Command() method where my buttons code is?

    -ScottA



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

    On 06/11/2012 at 16:51, xxxxxxxx wrote:

    Doh!
    Nevermind. I found what I was doing wrong.

    By using LayoutFlushGroup() when hiding the gizmo. I am basically deleting the gizmo from the dialog. So it has no way of returning back to where I started from when I choose to unhide it.

    So the code needs to be like this:

        switch (id)   
      {  
          case MY_BUTTON_HIDE:  
              HideElement(MY_GIZMO, TRUE);       //Tell C4D to hide this gizmo    
              LayoutChanged(GIZMO_GROUP_ID);     //Tell C4D the group this gizmo is in has changed  
              break;  
      
          case MY_BUTTON_UNHIDE:  
              HideElement(MY_GIZMO, FALSE);     //Tell C4D to unhide this gizmo    
              LayoutChanged(GIZMO_GROUP_ID);    //Tell C4D the group this gizmo is in has changed  
              break;  
      }
    

    The way the docs are written. It sort of led me to believe that we had to use Flush to hide/unhide gizmos.
    But that's not the case.

    -ScottA


Log in to reply