THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 22/01/2009 at 17:14, xxxxxxxx wrote:
Just to make sure we are talking about the same thing. This is an example plugin dialog with AddColorChooser(). Of course the look depends on Cinema's color chooser preferences.

Here is the complete source code of the example dialog:
> \> ///////////////////////////////////////////////////////////// \> // CINEMA 4D SDK // \> ///////////////////////////////////////////////////////////// \> // (c) 1989-2004 MAXON Computer GmbH, all rights reserved // \> ///////////////////////////////////////////////////////////// \> \> // example code for a menu/manager plugin \> \> // be sure to use a unique ID obtained from www.plugincafe.com \> #define ID_ASYNCTEST 1000955 \> \> #include "c4d.h" \> #include "c4d_symbols.h" \> \> \> class AsyncDialog : public GeDialog \> { \> private: \> C4DGadget \*colorchooser; \> \> public: \> AsyncDialog(void); \> virtual Bool CreateLayout(void); \> virtual Bool InitValues(void); \> virtual Bool Command(LONG id,const BaseContainer &msg;); \> }; \> \> enum \> { \> IDC_COLOR = 1000 \> }; \> \> AsyncDialog::AsyncDialog(void) \> { \> colorchooser = NULL; \> } \> \> Bool AsyncDialog::CreateLayout(void) \> { \> // first call the parent instance \> Bool res = GeDialog::CreateLayout(); \> \> SetTitle("GuiDemo C++"); \> \> GroupBegin(0,BFH_SCALEFIT|BFV_SCALEFIT,1,0,"",0); \> { \> colorchooser = AddColorChooser(IDC_COLOR,BFH_LEFT|BFV_TOP,SizePix(400),0,0); \> } \> \> return res; \> } \> \> Bool AsyncDialog::InitValues(void) \> { \> // first call the parent instance \> if (!GeDialog::InitValues()) return FALSE; \> \> return TRUE; \> } \> \> Bool AsyncDialog::Command(LONG id,const BaseContainer &msg;) \> { \> switch (id) \> { \> case IDC_COLOR: \> { \> Vector color; \> Real brightness; \> if(colorchooser && GetColorField(colorchooser, color, brightness)) \> { \> //do something with color and brightness \> \> GePrint(RealToString(color.x)+" "+RealToString(color.y)+" "+RealToString(color.z)); \> GePrint(RealToString(brightness)); \> } \> } \> break; \> } \> return TRUE; \> } \> \> \> class AsyncTest : public CommandData \> { \> private: \> AsyncDialog dlg; \> public: \> virtual Bool Execute(BaseDocument \*doc); \> virtual LONG GetState(BaseDocument \*doc); \> virtual Bool RestoreLayout(void \*secret); \> }; \> \> LONG AsyncTest::GetState(BaseDocument \*doc) \> { \> return CMD_ENABLED; \> } \> \> Bool AsyncTest::Execute(BaseDocument \*doc) \> { \> return dlg.Open(TRUE,ID_ASYNCTEST,-1,-1); \> } \> \> Bool AsyncTest::RestoreLayout(void \*secret) \> { \> return dlg.RestoreLayout(ID_ASYNCTEST,0,secret); \> } \> \> \> Bool RegisterAsyncTest(void) \> { \> // decide by name if the plugin shall be registered - just for user convenience \> String name=GeLoadString(IDS_ASYNCTEST); if (!name.Content()) return TRUE; \> return RegisterCommandPlugin(ID_ASYNCTEST,name,0,NULL,String("C++ SDK Menu Test Plugin"),gNew AsyncTest); \> } \>
cheers,
Matthias