CGTalk > Software > Maxon Cinema 4D
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 01-19-2007, 02:06 PM   #1
SuperKOSTYA
New Member
Kostya
Kyiv, Ukraine
 
Join Date: Jan 2007
Posts: 3
Help!

Hi All! I'm beginner at script writing, but I need help: (лучше заменить хотя бы таким слово&#1084 heart of problem is to create of non-modal dialog window & to use drag'n'drop interface. In the given bellow code I tried to make a non-modal dialog window, but a new-created window blinks some time and disappears immediately after creating. I'm in panic, ‘cause I've spent two senseless days trying to solve the problem.


//************************************************** *****

class MyDialog : GeDialog
{
public:
MyDialog(d);
CreateLayout();
AskClose();
}

MyDialog::MyDialog(d)
{
super(d);
}

//*****************************************
MyDialog::CreateLayout()
{
SetTitle("Non modal window");
AddGroupBeginV(100010,BFV_CENTER, 1, "", 0);
AddStaticText(100011, 0, 0, 0, "YO!", 0);
AddEditText(100011, 0 , 200, 10);
AddButton(1001, BFV_CENTER, 100, 10, "Button");
AddGroupEnd();
AddDlgGroup(DLG_OK | DLG_CANCEL);
return TRUE;
}

MyDialog::AskClose()
{
return FALSE;
}


main(doc,op)
{
CallCommand(13957); //Clear Console Entries
var x=new(MyDialog,1);

x->Open(true,100,100); //Open the dialog
}

Last edited by SuperKOSTYA : 01-20-2007 at 10:38 AM.
 
Old 01-20-2007, 11:13 AM   #2
Darter
Positive buoyancy
 
Darter's Avatar
David Wickenden
Ballina, Australia
 
Join Date: Nov 2003
Posts: 1,220
Here's a working version of your dialog. I've included a derived class from MenuPlugin, based on the SDK example file. This means that the dialog can now be loaded from the Plugins menu.

Before using, make sure that you provide a plugin ID as indicated at the beginning of the code. IDs between 1000001-1000010 can be used for development but you must obtain a unique ID from Plugin Cafe before releasing a plugin.

Code:
//**********Non-modal Dialog*************** var PLUGIN_ID = //Insert plugin ID here!! class MyDialog : GeDialog { public: MyDialog(); CreateLayout(); AskClose(); } MyDialog::MyDialog() { super(PLUGIN_ID); } //********************************************* MyDialog::CreateLayout() { SetTitle("Non modal window"); AddGroupBeginV(100010,BFV_CENTER, 1, "", 0); { AddGroupSpace(4,4); AddGroupBorder(BORDER_OUT); AddGroupBorderSpace(4,4,4,4); AddStaticText(100011, 0, 0, 0, "YO!", 0); AddEditText(100011, 0 , 200, 10); AddButton(1001, BFV_CENTER, 100, 10, "Button"); AddGroupEnd(); } AddDlgGroup(DLG_OK | DLG_CANCEL); return TRUE; } MyDialog::AskClose() { return FALSE; } //********************************************** class MyMenuPlugin : MenuPlugin { public: MyMenuPlugin(); GetID(); GetName(); GetHelp(); GetState(); Execute(doc); RestoreLayout(secret); } MyMenuPlugin::MyMenuPlugin() { super(); } MyMenuPlugin::GetState() { return CMD_ENABLED; } MyMenuPlugin::GetID() { return PLUGIN_ID; } MyMenuPlugin::GetName() { return "Kostya's Plugin"; } MyMenuPlugin::GetHelp() { return "Yo dude"; } var d; MyMenuPlugin::Execute(doc) { d->Open(TRUE, -1, -1); } MyMenuPlugin::RestoreLayout(secret) { if (!d) d = new(MyDialog); d->RestoreLayout(secret); } main() { d = new(MyDialog); Register(MyMenuPlugin); }
 
Old 01-22-2007, 02:41 PM   #3
SuperKOSTYA
New Member
Kostya
Kyiv, Ukraine
 
Join Date: Jan 2007
Posts: 3
Great! Thank you for your help! But what can you advice me about to create a non-modal window directly in script manager without using a MenuPlugin (after Execute-button pressing). Is it real?
 
Old 01-22-2007, 08:39 PM   #4
Darter
Positive buoyancy
 
Darter's Avatar
David Wickenden
Ballina, Australia
 
Join Date: Nov 2003
Posts: 1,220
No, it's not possible to use dialogs with scripts so you'll have to create a Menu Plugin to put your dialog to use.
 
Old 01-23-2007, 06:52 AM   #5
SuperKOSTYA
New Member
Kostya
Kyiv, Ukraine
 
Join Date: Jan 2007
Posts: 3
Well. Thank you for your worry about my problem! It made me clear

Last edited by SuperKOSTYA : 01-24-2007 at 06:50 AM.
 
Old 01-23-2007, 06:52 AM   #6
CGTalk Moderation
Lord of the posts
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,480
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 02:03 AM.


Powered by vBulletin
Copyright ©2000 - 2016, Jelsoft Enterprises Ltd.