Setting parameters for EDITNUMBER in res-file



  • On 08/11/2017 at 02:31, xxxxxxxx wrote:

    Hi and Welcome to the Plugin Cafe forums!

    In a resource file for a dialog usually only layout and size settings can be specified for the gadgets.
    An EDITNUMBER's type, min/max, step etc. have to be set with GeDialog.SetFloat().
    Note SetReal() was renamed to SetFloat() several releases ago.



  • On 08/11/2017 at 03:41, xxxxxxxx wrote:

    Hi Yannick,

    thank you for your help.
    That's my fault. I've tried the SetFloat() method.

    Actually the res file looks something like this:

      
    DIALOG BS_MC  
    {  
      NAME BS_MC_TITLE; FIT_V; SCALE_V; FIT_H; SCALE_H;  
        
      GROUP BS_MC_TRANSFORM_POSITION  
      {  
          ALIGN_TOP; ALIGN_LEFT;  
          SCALE_H;  
          COLUMNS 2;  
            
          STATICTEXT BS_MC_PX_TEXT { NAME BS_MC_PX_TEXT; }  
          EDITNUMBERARROWS BS_MC_PX_INPUT { }  
      
          STATICTEXT BS_MC_PY_TEXT { NAME BS_MC_PY_TEXT; }  
          EDITNUMBERARROWS BS_MC_PY_INPUT { }  
      
          STATICTEXT BS_MC_PZ_TEXT { NAME BS_MC_PZ_TEXT; }  
          EDITNUMBERARROWS BS_MC_PZ_INPUT { }  
      }  
    }  
    

    But not a single editnumberarrows field accept any value. Even the arrows are without function.

    The c++ file looks like this:

      
    Bool BS_MC_Dialog::CreateLayout(void)  
    {  
      Bool res = TRUE;  
      res = LoadDialogResource(BS_MC, nullptr, 0);  
      
      GroupBegin(BS_MC_GROUP, BFH_LEFT, 2, 0, "", 0);  
      {  
          GroupBorder(BORDER_ACTIVE_1);  
          GroupBorderSpace(4, 4, 4, 4);  
      
          AddStaticText(9000, BFH_LEFT, 0, 0, "Pos:", 0);  
      
          AddEditNumberArrows(9001, BFH_LEFT);  
      }  
      GroupEnd();  
      
      return res;  
    }  
      
    Bool BS_MC_Dialog::InitValues(void)  
    {  
      GePrint("InitValues");  
      
      if (!GeDialog::InitValues()) return FALSE;  
      
      GePrint("SetFloat");  
      
      this->SetFloat(MATERIALCHANGE_PX_INPUT, 0.5);  
      
      return TRUE;  
    }  
    

    The hard coded editnumberarrows-field is visible and fully functional.

    But the InitValues function seems not to be called, because both GePrints aren't called (don't print to the console).

    I can't find any failures but something seems to be missing...



  • On 08/11/2017 at 04:09, xxxxxxxx wrote:

    Now I extended the InitValues method with a SetFloat() for the hard coded editnumberarrows and it works. Even the geprint's are triggered now.

      
    Bool BS_MC_Dialog::InitValues(void)  
    {  
      GePrint("InitValues");  
      
      if (!GeDialog::InitValues()) return FALSE;  
      
    GePrint("SetFloat");  
      
      this->SetFloat(BS_MC_PX_INPUT, 0.5);  
      this->SetFloat(9001, 2.4);  
      
      return TRUE;  
    }  
    

    But still no effect on the loaded fields.
    Looks pretty strange to me.



  • On 08/11/2017 at 08:15, xxxxxxxx wrote:

    It looks like there is something wrong with the edit number arrows IDs used in the res file.
    Make sure BS_MC_PX_TEXT, BS_MC_PY_TEXT, BS_MC_PZ_TEXT IDs number are unique.



  • On 09/11/2017 at 02:29, xxxxxxxx wrote:

    Hi Yannick,

    in order to make sure there're no other failures I deleted the statictext-fields.
    But the result is still the same.

    For debugging I tried to print the result of SetFloat(...) to the console.
    And the result is false, so nothing was set.

    I guess it's because of the gadget id (tried the MATERIALCHANGE_PX_INPUT and the appropiate int).
    But I can't see why.



  • On 09/11/2017 at 03:59, xxxxxxxx wrote:

    Hi,

    The gadget ID to pass to SetFloat() is the one defined in c4d_symbols.h and used in the DIALOG resource.

    If you can post your latest IDs definitions, dialog resource and implementation, it will be easier to see where there's an issue.



  • On 09/11/2017 at 05:23, xxxxxxxx wrote:

    Hi Yannick,

    now I'm a little bit confused.
    The id's have to be defined in the c4d_symbols.h???

    At the moment my structure looks this was:
    BS >
    res >
        _c4d_symbols.h                   _(a list with the different plugins in BS)
        dialogs >
           _matchange.res               _ (defining the layout) _
            matchange.h                  _(defining the id's for the different gui elements)
        strings_de >
           dialogs >
              _matchange.str              _(the strings for the different gui elements)

    Am I right, that this isn't the correct structure?

    I'll post the asked definitions, resource and implementation in a second.



  • On 09/11/2017 at 05:45, xxxxxxxx wrote:

    Hi,

    Yes, dialog resources IDs have to be defined in c4d_symbols.h
    See Dialog Resource for more information on how these have to be written.



  • On 09/11/2017 at 05:50, xxxxxxxx wrote:

    Mh, stupid...
    Ok Yannick, then I'll first change this, test again and post the (hopefully) positive result.

    Thank you for your help.



  • On 09/11/2017 at 06:14, xxxxxxxx wrote:

    Suprise, it works...

    According to the folder structure of plugins using a description i build this dialog plugin and didn't realize the difference of both.

    Thank you a lot Yannick. Problem solved.

    Cheers,
    Svente


Log in to reply