Help with dialog

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  01 January 2007
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 January 2007 at 10:38 AM.
 
  01 January 2007
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.


 //**********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);
 }
 
 
  01 January 2007
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?
 
  01 January 2007
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.
 
  01 January 2007
Well. Thank you for your worry about my problem! It made me clear

Last edited by SuperKOSTYA : 01 January 2007 at 06:50 AM.
 
  01 January 2007
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



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 09:30 AM.


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