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

Custom Gui - How to hide the label?

Page  <12
Author
Message
  Topic Search Topic Search
Katachi View Drop Down
Member
Member
Avatar

Joined: 2002 Oct 30
Location: Germany
Online Status: Offline
Posts: 2543
Direct Link To This Post Posted: 2015 Jan 29 at 10:13am
Originally posted by NiklasR


I have only one problem left, unfortunately. I want one of the custom properties to be a String.

        GROUP {
            BANNER TEST { ICON_ID 5159; WIDTH 16; ALIGN_H "center"; LOCKSCALE; TRANSPARENT; }
        }


Hmm, not sure if that's the problem but get rid of the "":

        
            BANNER TEST { ICON_ID 5159; WIDTH 16; ALIGN_H center; LOCKSCALE; TRANSPARENT; }

Also, you shouldn't require a custom datatype to get the settings. At least it works here with a custom gui finely.


Edited by Katachi - 2015 Jan 29 at 10:15am
Back to Top
Andreas Block View Drop Down
Forum Moderator
Forum Moderator
Avatar

Joined: 2014 Oct 01
Location: Hannover
Online Status: Offline
Posts: 1878
Direct Link To This Post Posted: 2015 Mar 11 at 12:04pm
Niklas,
have you been able to get it working?

Cheers,
Andreas
SDK Support Engineer
Back to Top
NiklasR View Drop Down
Member
Member


Joined: 2010 Dec 13
Location: Germany
Online Status: Offline
Posts: 2575
Direct Link To This Post Posted: 2015 May 22 at 6:00am
No unfortunately not. But I had an idea: Could it be that String custom property can not be a hardcoded
string inside the description resource, but must instead be a resource symbol that will be loaded from the
stringtable? I'll try it out as soon as I can.


Edited by NiklasR - 2015 May 22 at 6:01am
Back to Top
Katachi View Drop Down
Member
Member
Avatar

Joined: 2002 Oct 30
Location: Germany
Online Status: Offline
Posts: 2543
Direct Link To This Post Posted: 2015 May 22 at 6:14am
Hmm, I don't think so. The above way does not work for you?
In my custom gui I get the string in the constructor with
m_unit = settings.GetString(MY_UNIT);

and in my description resource it looks like this
REAL ELEMENT_ID { MIN 0; MAX 100; CUSTOMGUI FXUNIT; MY_UNIT SQR_METER; }

then I get a string from the stringtable with
if(m_unit.Compare("SQR_METER")==0)
unit_str = GeLoadString(DPIT_SQR);
works all fine here.
Back to Top
NiklasR View Drop Down
Member
Member


Joined: 2010 Dec 13
Location: Germany
Online Status: Offline
Posts: 2575
Direct Link To This Post Posted: 2015 May 22 at 6:23am
Katachi, that is actually what I meant in my previous post. :) And right now I see in the SDK, the
documentation of CUSTOMTYPE_STRING says: "String data. (An ID from the string table.)".
So, to use it, it must be set up like this?

mydescription.res
CONTAINER mydescription {
    GROUP {
        BANNER MY_BANNER { TITLE MY_BANNER_TITLE; }
    }
}

mydescription.str
STRINGTABLE mydescription {
    MY_BANNER_TITLE "The string to be passed to the TITLE property here";
}

I thought I could use it to write in-line strings into the description. I wanted to use it to specify the
alignment of the banner image using the words "left", "center" and "right" instead of using integers
like -1, 0 and 1 respectively.

Solved [x]

Big smile
Back to Top
Katachi View Drop Down
Member
Member
Avatar

Joined: 2002 Oct 30
Location: Germany
Online Status: Offline
Posts: 2543
Direct Link To This Post Posted: 2015 May 22 at 6:38am
yes, exactly like that. :) Yeah, directly inline won't work but well you can still use LEFT, RIGHT and CENTER instead of MY_BANNER_TITLE right? You would just add each of them to your .str file like:

LEFT "Left";
CENTER "Center";
RIGHT "Right";
Back to Top
NiklasR View Drop Down
Member
Member


Joined: 2010 Dec 13
Location: Germany
Online Status: Offline
Posts: 2575
Direct Link To This Post Posted: 2015 May 22 at 7:49am
But my plugin is a Custom Gui plugin, and the other plugin that makes use of the Custom Gui should
not need to add LEFT CENTER and RIGHT to its Stringtable when it wants to use the Custom Gui. ;)
Back to Top
Katachi View Drop Down
Member
Member
Avatar

Joined: 2002 Oct 30
Location: Germany
Online Status: Offline
Posts: 2543
Direct Link To This Post Posted: 2015 May 22 at 12:32pm
It doesn't have to. The other plugin can simply use LEFT, RIGHT and CENTER as well (of course the custom gui must be installed). It doesn't have to redefine them in its stringtable. Or what do you mean?
Back to Top
NiklasR View Drop Down
Member
Member


Joined: 2010 Dec 13
Location: Germany
Online Status: Offline
Posts: 2575
Direct Link To This Post Posted: 2015 May 22 at 11:30pm
Oh really? In what Stringtable need LEFT,CENTER and RIGHT be defined then?
Back to Top
Katachi View Drop Down
Member
Member
Avatar

Joined: 2002 Oct 30
Location: Germany
Online Status: Offline
Posts: 2543
Direct Link To This Post Posted: 2015 May 23 at 1:05am
They should be defined in the stringtable of the customgui of yours.
Then once that customgui is installed, the description (and its resources) are registered too so any parsing of your customgui by c4d (no matter where in c4d) shall allow to use these flags.
Back to Top
NiklasR View Drop Down
Member
Member


Joined: 2010 Dec 13
Location: Germany
Online Status: Offline
Posts: 2575
Direct Link To This Post Posted: 2015 May 23 at 3:55am
I kind of feel like I don't get it. I don't see a way to register a stringtable or description resource with a
Custom GUI plugin. And I tried adding it to c4d_strings.str and c4d_symbols.h but I get a message when
the description that uses the Custom GUI is loaded "Symbol 'RIGHT' could not be found".

Tried both ways, in the plugin that uses the Custom GUI and in the Custom GUI plugin itself.

#ifndef C4D_SYMBOLS_H__
#define C4D_SYMBOLS_H__

enum
{
  LEFT,
  RIGHT,
  CENTER
};

#endif // C4D_SYMBOLS_H__

STRINGTABLE
{
  LEFT "left";
  RIGHT "right";
  CENTER "center";
}


Edited by NiklasR - 2015 May 23 at 3:56am
Back to Top
Katachi View Drop Down
Member
Member
Avatar

Joined: 2002 Oct 30
Location: Germany
Online Status: Offline
Posts: 2543
Direct Link To This Post Posted: 2015 May 23 at 4:16am
You need to use RegisterDescription (I do it in PluginMessage with C4DPL_INIT_SYS) to have it registered along with your customgui. Then it should work.
Back to Top
NiklasR View Drop Down
Member
Member


Joined: 2010 Dec 13
Location: Germany
Online Status: Offline
Posts: 2575
Direct Link To This Post Posted: 2015 May 23 at 4:47am
Thanks Katachi, that makes sense to me. :-)

Edit: Oh well, I fail at doing good test cases. LOL Actually no, it doesn't really work with a LONG prop.
It just uses zero as the value when it can't convert the value to a number, and I didn't notice that my
banner image was centered instead of right aligned in my test case (you might ask yourself how you
can not see that immediately..)

Seems like I can't get this to work atm. When I have time next week I'll make a stripped down custom
datatype plugin and test it again. Thanks for your help Katachi!

-Niklas



Unfortunately, it still doesn't work with a CUSTOMTYPE_STRING propety. But it works with a LONG prop!

nrbannergui.h

#if 0
enum
{
  LEFT = -1,
  RIGHT = 1,
  CENTER = 0,
};
#endif

The CustomProperty is

{ CUSTOMTYPE_LONG,   BANNERGUI_HALIGN,         "HALIGN" }

And handled in the iCustomGui constructor as

  Int32 align = bc.GetInt32(BANNERGUI_HALIGN);
  if (align < 0)       this->alignH = BANNERGUI_HALIGN_LEFT;
  else if (align == 0) this->alignH = BANNERGUI_HALIGN_CENTER;
  else if (align > 0)  this->alignH = BANNERGUI_HALIGN_RIGHT;

And since I use the custom property on both the custom GUI and custom datatype, I registered the
description for both.

  if (!RegisterDescription(CUSTOMGUI_BANNER, "nrbannergui")) return false;
  if (!RegisterDescription(CUSTOMDATATYPE_BANNER, "nrbannergui")) return false;

Now I can use it in my plugin description as

  GROUP {
    NR_BANNER  MY_BANNER { ICON_ID 1035231; ICON_ID_HOVER 1035232; BUTTON; BGCOLOR_VECTOR 0.157 0.353 0.663; HALIGN RIGHT; }
  }

Thanks again!

-Niklas


Edited by NiklasR - 2015 May 23 at 4:58am
Back to Top
Page  <12

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.125 seconds.