Edit C4DGadget on Pluginstart
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 23/07/2008 at 02:16, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 10.5
Platform: Mac ;
Language(s) : C++ ;---------
Hi!I habe a problem with GUIDialog. I want to use SetString in the command-method but it does not work. The GeDialog is created on startup and the adress is stored in a global pointer_var.
So I send a string in a BaseContainer to the command method and read it out. But SetString() only works, when I opened the dialog one time before. So, what can I do?
Thanks and bye
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 23/07/2008 at 03:52, xxxxxxxx wrote:
Can you please give a more detailed explaination of the problem because I can't quite follow you here.
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 23/07/2008 at 04:52, xxxxxxxx wrote:
Hi!
I am sorry, I don't know how to explain it very well.
Imagine I want to write something into a C4DGadget in a GUIDialog thats not opened yet on startup.
Like the normal c4d console. On startup I can use GePrint() and the text is written into the console altough the console was not opened yet.
My first-step-solution: "Create a global pointer adress and create a new object of this GUIDialog. The Commanddata calls this global pointer too, that not two seperate windows are created. But after the creation of the GeDialog, it does not know which Gadgets are stored in the Dialog, so, how is it solved in the console that you can write something to the console gadget, thats not in the memory yet on startup?"
Thanks
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 23/07/2008 at 06:04, xxxxxxxx wrote:
You can't. The gadgets come into existence when the dialog is opened and CreateLayout() is (automatically) called.
You can store the information somewhere in a class member either of the CommandData or the dialog and use that during the call to CreateLayout().
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 23/07/2008 at 06:35, xxxxxxxx wrote:
Why not store the text in member variable of the dialog class? Something like this:
>
\> // (c) 1989-2004 MAXON Computer GmbH, all rights reserved // \> ///////////////////////////////////////////////////////////// \> \> // example code for usage of listview elements \> \> // be sure to use a unique ID obtained from www.plugincafe.com \> #define ID_LISTVIEWTEST 1000452 \> \> #include "c4d.h" \> #include "c4d_symbols.h" \> \> class ListViewDialog : public GeDialog \> { \> private: \> String mytext; \> public: \> ListViewDialog(void); \> virtual ~ListViewDialog(void); \> \> virtual Bool CreateLayout(void); \> \> void SetMyText(String text) { mytext = text; }; \> }; \> \> ListViewDialog::ListViewDialog(void) \> { \> mytext = ""; \> } \> \> ListViewDialog::~ListViewDialog(void) \> { \> } \> \> Bool ListViewDialog::CreateLayout(void) \> { \> // first call the parent instance \> Bool res = GeDialog::CreateLayout(); \> \> res = LoadDialogResource(DLG_LISTVIEW,NULL,0); \> \> if (res) \> { \> SetString(GADGET_MYTEXT, mytext); \> } \> \> return res; \> } \> \> class ListViewTest : public CommandData \> { \> private: \> ListViewDialog dlg; \> public: \> virtual Bool Execute(BaseDocument \*doc); \> virtual LONG GetState(BaseDocument \*doc); \> virtual Bool RestoreLayout(void \*secret); \> }; \> \> LONG ListViewTest::GetState(BaseDocument \*doc) \> { \> return CMD_ENABLED; \> } \> \> Bool ListViewTest::Execute(BaseDocument \*doc) \> { \> dlg.SetMyText("hello world"); \> return dlg.Open(TRUE,ID_LISTVIEWTEST,-1,-1); \> } \> \> Bool ListViewTest::RestoreLayout(void \*secret) \> { \> return dlg.RestoreLayout(ID_LISTVIEWTEST,0,secret); \> } \> \> Bool RegisterListView(void) \> { \> // decide by name if the plugin shall be registered - just for user convenience \> String name=GeLoadString(IDS_LISTVIEW); if (!name.Content()) return TRUE; \> return RegisterCommandPlugin(ID_LISTVIEWTEST,name,0,NULL,String(),gNew ListViewTest); \> } \>
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 23/07/2008 at 07:01, xxxxxxxx wrote:
Hi!
Yes, a variable stored in the class is a solution, but I thought there is an alternative, because its a lot of text, so I would put it twice in the memory. (variable and the gadget)
Thank you Matthias, kuroyume0161 for your great help.. I will solve it like you suggested it.