Plugin Cafe Homepage
Forum Home Forum Home > Plugin Cafe > SDK Help
  New Posts New Posts
  FAQ FAQ  Forum Search   Register Register  Login Login

Setting parameters for EDITNUMBER in res-file

 Post Reply Post Reply
Author
Message
Svente View Drop Down
Member
Member


Joined: 2017 Nov 07
Location: Wolfsburg
Online Status: Offline
Posts: 14
Post Options Post Options   Quote Svente Quote  Post ReplyReply Direct Link To This Post Topic: Setting parameters for EDITNUMBER in res-file
    Posted: 2017 Nov 07 at 7:21am

User Information:

Cinema 4D Version:   18.051 
Platform:   Windows  ;   
Language(s):     C++  ;   

---------

Hi everybody,

is there a way to define the values for type (float/int), min and max for EDITNUMBER GUI-elements within the res-file of a dialog?

I've tried in within my command plugin directly via c++ and it worked fine. But I can't get the field get working and/or formatted while using the res-file.

Cheers,
Svente
Back to Top
Svente View Drop Down
Member
Member


Joined: 2017 Nov 07
Location: Wolfsburg
Online Status: Offline
Posts: 14
Post Options Post Options   Quote Svente Quote  Post ReplyReply Direct Link To This Post Posted: 2017 Nov 08 at 1:40am
According to an example of Scott (ResBasedDialog) I've tried to set the parameters in the GeDialog::InitValues() function. But it seems, that the function isn't called at any time. So the call of this->SetReal(id, val); has no effect.
Any ideas?
Back to Top
Yannick Puech View Drop Down
Forum Moderator
Forum Moderator


Joined: 2011 Apr 13
Location: Spain
Online Status: Offline
Posts: 1039
Post Options Post Options   Quote Yannick Puech Quote  Post ReplyReply Direct Link To This Post Posted: 2017 Nov 08 at 2:31am
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.





Edited by Yannick Puech - 2017 Nov 08 at 2:32am
MAXON
Developer Support
Back to Top
Svente View Drop Down
Member
Member


Joined: 2017 Nov 07
Location: Wolfsburg
Online Status: Offline
Posts: 14
Post Options Post Options   Quote Svente Quote  Post ReplyReply Direct Link To This Post Posted: 2017 Nov 08 at 3:41am
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...

Back to Top
Svente View Drop Down
Member
Member


Joined: 2017 Nov 07
Location: Wolfsburg
Online Status: Offline
Posts: 14
Post Options Post Options   Quote Svente Quote  Post ReplyReply Direct Link To This Post Posted: 2017 Nov 08 at 4:09am
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.
Back to Top
Yannick Puech View Drop Down
Forum Moderator
Forum Moderator


Joined: 2011 Apr 13
Location: Spain
Online Status: Offline
Posts: 1039
Post Options Post Options   Quote Yannick Puech Quote  Post ReplyReply Direct Link To This Post Posted: 2017 Nov 08 at 8:15am
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.



MAXON
Developer Support
Back to Top
Svente View Drop Down
Member
Member


Joined: 2017 Nov 07
Location: Wolfsburg
Online Status: Offline
Posts: 14
Post Options Post Options   Quote Svente Quote  Post ReplyReply Direct Link To This Post Posted: 2017 Nov 09 at 2:29am
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.

Back to Top
Yannick Puech View Drop Down
Forum Moderator
Forum Moderator


Joined: 2011 Apr 13
Location: Spain
Online Status: Offline
Posts: 1039
Post Options Post Options   Quote Yannick Puech Quote  Post ReplyReply Direct Link To This Post Posted: 2017 Nov 09 at 3:59am
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.




MAXON
Developer Support
Back to Top
Svente View Drop Down
Member
Member


Joined: 2017 Nov 07
Location: Wolfsburg
Online Status: Offline
Posts: 14
Post Options Post Options   Quote Svente Quote  Post ReplyReply Direct Link To This Post Posted: 2017 Nov 09 at 5:23am
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.
Back to Top
Yannick Puech View Drop Down
Forum Moderator
Forum Moderator


Joined: 2011 Apr 13
Location: Spain
Online Status: Offline
Posts: 1039
Post Options Post Options   Quote Yannick Puech Quote  Post ReplyReply Direct Link To This Post Posted: 2017 Nov 09 at 5:45am
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.



MAXON
Developer Support
Back to Top
Svente View Drop Down
Member
Member


Joined: 2017 Nov 07
Location: Wolfsburg
Online Status: Offline
Posts: 14
Post Options Post Options   Quote Svente Quote  Post ReplyReply Direct Link To This Post Posted: 2017 Nov 09 at 5:50am
Mh, stupid...
Ok Yannick, then I'll first change this, test again and post the (hopefully) positive result.

Thank you for your help.
Back to Top
Svente View Drop Down
Member
Member


Joined: 2017 Nov 07
Location: Wolfsburg
Online Status: Offline
Posts: 14
Post Options Post Options   Quote Svente Quote  Post ReplyReply Direct Link To This Post Posted: 2017 Nov 09 at 6:14am
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
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Bulletin Board Software by Web Wiz Forums® version 9.61 [Free Express Edition]
Copyright ©2001-2009 Web Wiz

This page was generated in 0.109 seconds.