THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 18/04/2006 at 02:13, xxxxxxxx wrote:
Hi again,
it does matter, because:
1. I want to check for input errors only on "OK". I could do that with the
GetResult()
also in the
AskClose()
function, but I thought there would be a way of "clean" programming.
2. I want to create an object depending on the input of the GUI. I would do that in
AskClose()
, but then the object is created twice, since the function is called twice.
Here is the simple example (sorry for the long post) :
//dummy.cof
const var PlugID_dummy = 1000008;
var dummy_resource;
include "c4d_symbols.h"
class dummy_dialog : GeModalDialog
{
public:
dummy_dialog();
CreateLayout();
Command(id, msg);
private:
AskClose();
}
dummy_dialog::dummy_dialog()
{
super();
}
dummy_dialog::CreateLayout()
{
return(LoadDialogResource(dummy_layout, dummy_resource, 0));
}
dummy_dialog::Command(id, msg)
{
return TRUE;
}
dummy_dialog::AskClose()
{
println("Calling AskClose().");
return FALSE;
}
class dummy_menu : MenuPlugin
{
public:
dummy_menu();
GetID();
GetName();
GetHelp();
Execute(doc);
private:
var dialog;
}
dummy_menu::dummy_menu()
{
super();
dialog = 0;
}
dummy_menu::GetID() { return PlugID_dummy; }
dummy_menu::GetName() { return "Dummy Menu"; }
dummy_menu::GetHelp() { return "just a test"; }
dummy_menu::Execute(doc)
{
dialog = new(dummy_dialog);
dialog->Open( -1, -1);
return TRUE;
}
main()
{
var root = GeGetRootFilename();
root->RemoveLast();
dummy_resource = new(GeResource, root);
Register(dummy_menu);
println("dummy loaded.");
}