How to use the customgui files?



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

    On 23/08/2011 at 14:58, xxxxxxxx wrote:

    Yes. It works and swaps the image if put the button call code in the Command method.

    This is why I get confused about using the Message method and the Command method.
    When I use the built in buttons to communicate a click event. Matthias told me to use the Message method so C4D updates when they are clicked. And it works.
    Yet in this case (as well as some other cases) . The click event has to happen in the Command method.
    I wish I had a better understanding of what's going on in those two methods. And why this is the case.

    I think I understand the basics of SetToggleState(). But I'm having trouble assigning it to a variable and using it as a way to check if the button has been clicked.

    And I also need to know how to handle the SetCallback() function.
    What it does and what it's used for....etc. That kind of thing.

    -ScottA



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

    On 24/08/2011 at 01:50, xxxxxxxx wrote:

    Perhaps Matthias, if he's reading this thread, could explain about the Command vs. Message functions in GeDialog?

    For me though the SDK is clear: Command is used when the user clicks on a gadget, Message for handling messages not covered by the other functions. In fact, the SDK specifically says that normally you don't need to override Message in a GeDialog.

    You've hit on a significant problem with the SDK with things like SetCallback. It isn't so much how to use it (though there's that too) but why you'd want to use it at all. Unless you're lucky enough to find an example in the SDK or here then you're working in the dark.



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

    On 24/08/2011 at 11:34, xxxxxxxx wrote:

    I've got the process of adding CustomGui's down now.
    It's a pretty simple process with a few steps of importing things from the customgui_ source files.
    But now I'm running into all kinds of things that don't seem to work as documented.
    Or at least as I'm interpreting them by following the docs in a literal manner.

    For example.
    The _BaseCustomGui example which is used for layout stuff does not work for me when I used what the docs say to use:

    Bool myDialog::CreateLayout(void)  
    {  
      BaseContainer bcBase; // Create the containers for Custom GUI's    
      SetTitle("Custom GUI Example");  
      
      GroupBegin(0,BFH_SCALEFIT|BFV_SCALEFIT,0,1,String(),0);      
      myBase = (_BaseCustomGui* )AddCustomGui(10006,CUSTOMGUI_LAYOUTMODE,String(),BFH_SCALEFIT|BFV_SCALEFIT,0,0,bcBase); // Adds the Base GUI to the dialog  
      GroupEnd();  
      
      return TRUE;  
    }  
      
    Bool myDialog::Command(LONG id,const BaseContainer &msg)  
    {  
      
      LONG width = myBase->GetWidth(PLUGIN_ID);       //Gets the width in pixels of the GUI  
      LONG mode = myBase->GetLayoutMode(PLUGIN_ID);   //Get the GUI's layout mode  
      GePrint(LongToString(width));                  // Results in zero!!??  
      GePrint(LongToString(mode));                   // Results in zero!!??  
      
      int layoutswitch = myBase->SupportLayoutSwitch(PLUGIN_ID); //Checks to see if layout switching is supported  
      GePrint(RealToString(layoutswitch));  
      
      
      switch (id)  
      {     
         case 10001:  
                  GePrint("Bitmap Button was Pushed");                  
          myButton->SetToggleState(TRUE);                                  
          Filename file1 = Filename("C:\\Users\\user\\Desktop\\image2.jpg"); //swap the button's image with this one  
          myButton->SetImage(file1, FALSE);                                  //This works as expected   
          LONG layoutmode = myBase->GetLayoutMode(PLUGIN_ID);  
              if (layoutmode==LAYOUTMODE_MAXIMIZED)    GePrint("Maximized");     // Does not work!!  
          myBase->SetLayoutMode(PLUGIN_ID, LAYOUTMODE_MINIMIZED);            //Does not work!!  
                  break;  
      }  
      
      
      switch (id)  
      {     
         case 10002:  
                  GePrint("Reset Button was Pushed");                              
          Filename file1 = Filename("C:\\Users\\user\\Desktop\\image1.jpg"); //swap the button's image with this one  
          myButton->SetImage(file1, FALSE);  
          myButton->SetToggleState(FALSE);      
                  break;        
      }  
        
      return TRUE;  
    }
    

    None of the layout stuff works.
    Everything returns a zero value as if it's not properly pointing to my dialog window.

    -ScottA



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

    On 30/08/2011 at 08:19, xxxxxxxx wrote:

    Sorry for the delay.

    This line makes no sense to me. What kind of cosuom GUI element do you want to add to your layout?

    myBase = (_BaseCustomGui* )AddCustomGui(10006,CUSTOMGUI_LAYOUTMODE,String(),BFH_SCALEFIT|BFV_SCALEFIT,0,0,bcBase);
    

    Also in response to Steve's question about buttons and Message vs. Command - it's important to keep in mind if you are using descriptions or dialogs. Buttons in descriptions are checked in Message, in dialogs you use Command instead.

    cheers,
    Matthias



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

    On 30/08/2011 at 09:02, xxxxxxxx wrote:

    Thanks Matthias. I think the initial question was whether to use GeDialog::Command or GeDialog::Message to respond to button clicks (I'd always used Command). But if Message can also be used to detect button clicks in a dialog, as Scott said worked for him, the question then, and I suppose it's a bit academic, is whether there is any difference to using these methods *within GeDialog*.

    Steve



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

    On 30/08/2011 at 14:59, xxxxxxxx wrote:

    I'm exploring all of the custom GUI stuff Matthias.
    Just generally trying to go through them all and create simple working examples of them so I can just copy and paste the code into my plugins when needed. Instead of having to spend the time to figure them out One-by-one. When I'm in the middle of writing an actual plugin.
    This would be sooooo much easier to learn if there were customGUI examples to learn from.

    In the example I posted. I wanted to click on my bitmap button and have the SetLayoutMode() function minimize my dialog window. I assume that's one of the things that SetLayoutMode()  does?
    But I keep getting zero return values from it when I click my button.

    Thanks for the Message() vs. Command() button info.

    -ScottA



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

    On 30/08/2011 at 21:37, xxxxxxxx wrote:

    You assume incorrectly.  SetLayoutMode() minimizes/maximizes "layout" groups within the dialog - in this case, the group belonging to the customgui.  Never assume...



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

    On 31/08/2011 at 03:37, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    Thanks Matthias. I think the initial question was whether to use GeDialog::Command or GeDialog::Message to respond to button clicks (I'd always used Command). But if Message can also be used to detect button clicks in a dialog, as Scott said worked for him, the question then, and I suppose it's a bit academic, is whether there is any difference to using these methods *within GeDialog*.

    As mentioned checking button clicks in Message is only done for descriptions (NodeData::Message) not dialogs.

    cheers,
    Matthias



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

    On 31/08/2011 at 03:47, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    This would be sooooo much easier to learn if there were customGUI examples to learn from.

    I will try to get hold of some examples. Meanwhile there is a bit info on the forum. Also take a look at the datatype.cpp SDK example which is kinda related and shows how to write an own data type with an own GUI, although not really a custom GUI.

    cheers,
    Matthias



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

    On 31/08/2011 at 09:07, xxxxxxxx wrote:

    OK Thanks.
    And thanks for adding more examples in the C++ SDK docs. I've noticed that you've been adding some new ones in the recent updates.

    I can't just do a Google search for tutorials on this C4D API stuff like I can with raw C++. Or MS based API's. So SDK examples are very, very helpful.

    -ScottA


Log in to reply