Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

UI, destroy dialog on click of button

Engaged ,
Oct 06, 2010 Oct 06, 2010

Hi All,

I have created three buttons on my dialog (OK, Cancel and Remove). OK and Cancel working fine.

How can I destroy my dialog on click of Remove button?

Thanks,

Shonky

TOPICS
Scripting
1.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advisor , Oct 06, 2010 Oct 06, 2010

Hey!

This is same as Marc example:

win = new Window('dialog', 'test');

win.test_btn = win.add('button', undefined, 'New Document');
win.test_btn.onClick = function() {win.close(0);}
win.test_btn1 = win.add('button', undefined, 'Open Document');
win.test_btn1.onClick = function() {win.close(1);}

win.center();
var myDlg = win.show();

if(myDlg == 0){
    alert("New document");
}else if(myDlg == 1){
    alert("Open document");
}

Hope that helps.

--

tomaxxi

http://indisnip.wordpress.com/

Translate
Advisor ,
Oct 06, 2010 Oct 06, 2010

Hey!

U are using ScriptUI?

--

tomaxxi

http://indisnip.wordpress.com/

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Oct 06, 2010 Oct 06, 2010

Yes tomaxxi, I am using ScriptUI.

Shonky

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Oct 06, 2010 Oct 06, 2010

How can I destroy my dialog on click of Remove button?

Thanks,

Shonky

myWindow.close(/*optional_ret_value*/);

should do the job.

So from an onClick callback:

myRemoveButton.onClick = function() {this.window.close();};

@+

Marc

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Oct 06, 2010 Oct 06, 2010

Hi Marc,

Thanks, it's working but one more problem coming after this.

My script exit after clicking on this button.

On click of remove button I want close UI (dialog) and want remove some stuff from my document but its not working.

Any suggestion?

Thanks,

Baljeet

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Oct 06, 2010 Oct 06, 2010

Hey!

This is same as Marc example:

win = new Window('dialog', 'test');

win.test_btn = win.add('button', undefined, 'New Document');
win.test_btn.onClick = function() {win.close(0);}
win.test_btn1 = win.add('button', undefined, 'Open Document');
win.test_btn1.onClick = function() {win.close(1);}

win.center();
var myDlg = win.show();

if(myDlg == 0){
    alert("New document");
}else if(myDlg == 1){
    alert("Open document");
}

Hope that helps.

--

tomaxxi

http://indisnip.wordpress.com/

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Oct 06, 2010 Oct 06, 2010

Thanks tomaxxi and Marc, Problem solved now.

Shonky

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Oct 06, 2010 Oct 06, 2010
LATEST

Cool!

Glad it works!

Cheers!

--

tomaxxi

http://indisnip.wordpress.com/

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines