Resource file for radiogroup



  • On 23/01/2013 at 12:54, xxxxxxxx wrote:

    With some help of the Resource Editor, I tried to create a Radiobutton group.
    However, it keeps telling me line 10 is incorrect.
    What am I doing wrong?

    CONTAINER ECHOS
    {
      NAME ECHOS;
      INCLUDE Obase;

    GROUP ECHOSSETTINGS
      {
          BOOL ECHOSenable {}
     
          RADIOGROUP IDC_STATIC               <== WRONG?
          {
              RADIOGADGET IDC_RADIO1 { NAME IDS_RADIO;  }
              RADIOGADGET IDC_RADIO2 { NAME IDS_RADIO1; }
          }
          LONG ECHOSstartframe {MIN 0;}
          LONG ECHOSspeed {MIN 1;}
          LONG ECHOSnumber {MIN 1;}
      }
    }

    enum
    {
        
      ECHOSSETTINGS = 1001,
      ECHOSstartframe = 1002,
      ECHOSspeed = 1003,
      ECHOSnumber = 1004,
      ECHOSenable = 1005,
     
      IDC_STATIC  = 1006,
      IDC_RADIO1  = 1007,
      IDC_RADIO2  = 1008,
    };

    STRINGTABLE ECHOS
    {
      ECHOS "Echos";
      ECHOSstartframe "Start Frame";
      ECHOSspeed "Speed";
      ECHOSSETTINGS "Echo Settings";
      ECHOSnumber "Nr of Echos";
      ECHOSenable "Enable";

    IDS_RADIO    "Radio button";
      IDS_RADIO1   "Radio button";
      IDS_STATIC   "Group";

    }



  • On 23/01/2013 at 13:32, xxxxxxxx wrote:

    hm,

    i think a radio group can only contain one element. you have to use a group element inside
    the radio group if you wwant to place more than one element in it.

    GROUP IDC_MYRADIOGROUP
    {
    	GROUP
    	{
    		RADIOGADGET IDC_ELEMENT_0 {NAME IDS_ELEMENT_0 ;}
    		RADIOGADGET IDC_ELEMENT_1 {NAME IDS_ELEMENT_1 ;}
    	}
    }
    

    ps : the ressoure editor ouput should be used with caution, it generates quite often res 
    files which do not run correctly.



  • On 23/01/2013 at 14:24, xxxxxxxx wrote:

    Sorry, also with your example, it keeps complaining about line 10.

    CONTAINER ECHOS
    {
      NAME ECHOS;
      INCLUDE Obase;

    GROUP IDC_MYRADIOGROUP
      {
          GROUP
          {
              RADIOGADGET IDC_RADIO1 { NAME IDS_RADIO;  }   <== error reading resource
              RADIOGADGET IDC_RADIO2 { NAME IDS_RADIO1; }
          }

    }
    }



  • On 24/01/2013 at 02:42, xxxxxxxx wrote:

    The first 'GROUP' needs to be 'RADIOGROUP'. Then it should work.



  • On 24/01/2013 at 11:45, xxxxxxxx wrote:

    Sorry, that also did not work.

    file: echos.res
    CONTAINER ECHOS
    {
      NAME ECHOS;
      INCLUDE Obase;

    GROUP ECHOSSETTINGS
      {
          RADIOGROUP IDC_MYRADIOGROUP      <== error reading resource
          {
              GROUP
              {
                  COLUMNS 1;
                  RADIOGADGET IDC_RADIO1 { NAME IDS_RADIO1; }      
                  RADIOGADGET IDC_RADIO2 { NAME IDS_RADIO2; } 
              }
          }
      }
    }

    File: echos.h
    enum
    {
        
      ECHOSSETTINGS = 1001,

    IDC_RADIO1  = 1007,
      IDC_RADIO2  = 1008,
     
      IDC_MYRADIOGROUP = 1009,
    };

    File: echos.str
    STRINGTABLE ECHOS
    {
      ECHOS "Echos";

    ECHOSSETTINGS "Echo Settings";

    IDS_RADIO1    "Radio button";
      IDS_RADIO2    "Radio button";
    }

    I did not edit c4d_symbols.h

    What could be wrong?



  • On 24/01/2013 at 11:52, xxxxxxxx wrote:

    There are some .res files in the Maxon folder hierarchy that might help you with the formatting.
    This is the PREF_DIALOG .res file:

    // C4D-DialogResource  
    DIALOG PREF_DIALOG  
    {  
      NAME DIALOG_TITLE;  
        
      GROUP   
      {  
      ALIGN_TOP; ALIGN_LEFT; SIZE 0, 0;   
      BORDERSIZE 4, 4, 4, 4;   
      COLUMNS 1;  
      SPACE 4, 4;  
        
    //    STATICTEXT  { NAME HELLO_WORLD; CENTER_V; FIT_H; SIZE 0, 0; }  
      RADIOGROUP DEL_GROUP  
      {  
        GROUP  
        {  
            COLUMNS 1;  
            RADIOGADGET IDC_RADIO1 { NAME IDS_RADIO1; ALIGN_TOP; ALIGN_LEFT; SIZE 0, 0;  }  
            RADIOGADGET IDC_RADIO2 { NAME IDS_RADIO2; ALIGN_TOP; ALIGN_LEFT; SIZE 0, 0;  }  
              
        }  
    }  
      }  
      GROUP LIST_GRP  
      {  
          LISTVIEW IDC_LIST { SCALE_H; SCALE_V; SIZE 150,100; };  
      }  
      DLGGROUP { OK; CANCEL; }  
    }
    

    -ScottA



  • On 24/01/2013 at 11:56, xxxxxxxx wrote:

    Wait a moment. You're writing a description, aren't you? Because you've got this:

      
    CONTAINER ECHOS   
    {   
        NAME ECHOS;   
        INCLUDE Obase;   
    

    That code is used for descriptions, not dialogs, but the radio buttons can only be used in dialogs. Did you edit the .res file by hand to add CONTAINER, etc.?

    I assumed when you said you used ResEdit that you were building a dialog. Your resource file would work, in that case. But it won't in a description.



  • On 24/01/2013 at 12:06, xxxxxxxx wrote:

    I do not know the difference between a description and a dialog.

    I'm trying to create a tag.
    That was ok, until I wanted to add radiobuttons.
    In above code I stripped most of the other code to pinpoint the error.

    This is the code I use to register my tag plugin.

    plugins.RegisterTagPlugin(id=PLUGIN_ID, str="Echos.", info=c4d.TAG_VISIBLE|c4d.TAG_EXPRESSION, g=ECHOS, description="echos",  icon=bmp)



  • On 24/01/2013 at 12:07, xxxxxxxx wrote:

    Also, I'm not using the ResEdit anymore.
    I do it by 'manually' editing the .res, .h and .str files.



  • On 24/01/2013 at 12:18, xxxxxxxx wrote:

    A dialog is the user interface you see in a dialog. Like the C4D preferences, that's a dialog.

    A description is what you see in the attribute manager, or the material editor. The two things are completely different but have enough similarities to be really confusing. Some elements are found in both, like GROUP. Some elements which look alike occur in both interface types but with different names. Some can only be used in one or other interface, such as RADIOGADGET (dialog only).

    If you're writing a tag, you need a description, so see 'Description resource' in the SDK. Descriptions tend to follow a set pattern so for most tags you will see something like this (taken from one of my tags) :

      
    CONTAINER Txgenattach   
    {   
         NAME Txgenattach;   
         INCLUDE Texpression;   
      
         GROUP ID_TAGPROPERTIES   
         {   
    

    The INCLUDE line adds the Priority drop down in the Basic tab. The GROUP named ID_TAGPROPERTIES will create a tab named 'Tag'. And so on.

    Never use the resource editor for descriptions, it won't work. (Some would say, never use the resource editor!)

    In your case you can't use radio buttons, try a drop-down instead (look for the LONG element with CYCLE flag).



  • On 24/01/2013 at 12:35, xxxxxxxx wrote:

    If I understand correctly, a description is in fact describing the object and its attributes.
    A dialog is asking the user to select certain options.
    What if I use python to build up the dialog instead of a resource file?
    E.g.
            self.AddRadioGroup(1000, c4d.BFH_SCALEFIT, 1)
            self.AddChild(1000, 0, 'Radio A')



  • On 24/01/2013 at 12:57, xxxxxxxx wrote:

    You cannot use a dialog as a description (from Python), therefore this won't have any use for you.
    Instead of the radio-elements, you could use the QUICKTABRADIO customgui. Example:

            LONG PR1M_ALIGNMENT_Y {
                CUSTOMGUI QUICKTABRADIO;
                CYCLE {
                    PR1M_ALIGNMENT_MINUS;
                    PR1M_ALIGNMENT_CENTER;
                    PR1M_ALIGNMENT_PLUS;
                }
            }
    

    Looks like this:



  • On 24/01/2013 at 13:01, xxxxxxxx wrote:

    It won't work. AddRadioGroup etc. are members of GeDialog, so you need a dialog to use them. They can't be used in a description.

    If you want the user to be able to select one option from a range of them use a LONG like so:

      
    LONG MY_CHOICES { CYCLE { OPTION_1; OPTION_2; OPTION_3; } }   
    

    Then you can find the option the user chose by accssing the BaseContainer for the tag (C++, sorry) :

      
    BaseContainer *bc = myTag->GetDataInstance();   
    if(bc)   
    {   
        LONG user_choice = bc->GetLong(MY_CHOICES);   
        if(user_choice == OPTION_1)   
            // do something   
        // etc.   
    


  • On 24/01/2013 at 13:10, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    Instead of the radio-elements, you could use the QUICKTABRADIO customgui.

    I'd forgotten about that, good reminder, thanks. A bit non-standard but it works.

    (Probably I'd forgotten because it is not documented in the SDK as with several other description elements.)



  • On 24/01/2013 at 13:13, xxxxxxxx wrote:

    So, why is it then possible, that I can create Radio buttons using User Data.
    Isn't that also a description?



  • On 24/01/2013 at 14:00, xxxxxxxx wrote:

    it is possible, it is the long customgui RADIOBUTTONS. the c4d description documenation
    is joke. in the python docs is none at all and the cpp documenation only contains 50% of 
    the flags.



  • On 24/01/2013 at 15:29, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    the c4d description documenation
    is joke. in the python docs is none at all and the cpp documenation only contains 50% of 
    the flags.

    Sad, but true. It really needs a good work up.


Log in to reply