Buttons in descriptionfiles
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 04/01/2007 at 07:18, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 9.507
Platform: Windows ;
Language(s) : C++ ;---------
Hi all and a happy new yeari got a question concerning buttons. I created a button in a description file. The button should open a dialog window if anyone clicks on it. Can anyone tell me if there is an event like "onclick_button" etc or how can i access this event?
Thanks 4 help
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 04/01/2007 at 08:50, xxxxxxxx wrote:
Check the Morphmixer SDK example for the use of buttons in descriptions. Basically you catch the MSG_DESCRIPTION_COMMAND and check for your description element ID.
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 05/01/2007 at 03:13, xxxxxxxx wrote:
Hi Matthias, thx for your reply. I created a new class out of GeDialog with the function CreateLayout as shown in the SDK:
class MyDialog : public GeDialog
{
public:
virtual Bool CreateLayout(void);
};Bool MyDialog::CreateLayout(void)
{
return LoadDialogResource(MY_DIALOG, NULL, 0);
}TagCone is a TagPlugin and i created the Message function as shown in the Morphmixer example:
Bool TagCone::Message(GeListNode *node, LONG type, void *data)
{
switch (type)
{
case MSG_DESCRIPTION_COMMAND:
{
DescriptionCommand *dc = (DescriptionCommand* ) data;
if (dc->id[0].id==ID_NEW_CONNECT)
{
GePrint("This works");
MyDialog *md;
md->CreateLayout();
}
}
}
return TRUE;
}Now i can see the letters "This works" in the Console when i press the button, but then C4D crashes. I think i have to initialize md first before i execute its function but i don't know how.
Can you help me (or somebody else)?
I just want to open the dialog MY_DIALOG by pressing the ID_NEW_CONNECT button in my description file ... -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 05/01/2007 at 03:42, xxxxxxxx wrote:
MyDialog md; //Memory allocation on stack
md.open(); //Open the dialog, CreateLayout is called automaticallythis is what you should do. You must create the dialog first. When you call anything from an empty pointer then it will crash for sure. Anyway, I don´t know what you want to do, but I would rather use a member pointer in your class, and then call
md = gNew MyDialog();
md->open();instead, otherwise the dialog will be freed when it leaves the message function, which is not what I think you intent. With the heap allocation you have to delete the dialog anywhere yourself then!
The last and best solution is that you use
MyDialog md;
directly as a member of your class, then you don´t have to think about it. It will be destroyed when your object gets destroyed.
CreateLayout() will be called automatically when you call open. You shouldn´t call it directly (if it isn´t necessary). Everything needs memory.
Have fun
Samir