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

Cancel Button

Participant ,
Jun 18, 2020 Jun 18, 2020

Copy link to clipboard

Copied

just realised that yes the OK button works on my win panel but no idea how to get the cancel button to function

TOPICS
Actions and scripting

Views

863

Translate

Translate

Report

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
Adobe
Community Expert ,
Jun 18, 2020 Jun 18, 2020

Copy link to clipboard

Copied

Hi,

It is difficult to tell what excatly where you face issue. Could you please provide more information? If you tried via script, share you script to see what you have done till now.

Best regards

Votes

Translate

Translate

Report

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
Advocate ,
Jun 18, 2020 Jun 18, 2020

Copy link to clipboard

Copied

Maybe you are looking for this

win.can.onClick = function ()
{
win.close ();
}

 

Votes

Translate

Translate

Report

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
LEGEND ,
Jun 18, 2020 Jun 18, 2020

Copy link to clipboard

Copied

Maybe use in yout code something like it:

 

.add('button', undefined, 'Cancel', {name: 'cancel'})

Votes

Translate

Translate

Report

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
Participant ,
Jun 18, 2020 Jun 18, 2020

Copy link to clipboard

Copied

I currently have the following code that creates both buttons, clicking on either causes the rest of the script to be run

 

	win.grp2 = win.add('group');
	win.select = win.grp2.add('button',undefined,'Ok');
	win.can = win.grp2.add('button',undefined,'Cancel');
	win.select.preferredSize = win.can.preferredSize=[70,20];
	
	var myReturn = win.show();{

Votes

Translate

Translate

Report

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
LEGEND ,
Jun 18, 2020 Jun 18, 2020

Copy link to clipboard

Copied

!(win.show() - 1)

Votes

Translate

Translate

Report

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
Community Expert ,
Jun 18, 2020 Jun 18, 2020

Copy link to clipboard

Copied

Hi mikedpe

Well, I think you get the answer above. But here is the complete version grouped all together :-). In place of alert message, you can add your own processing. And your code shared above is not correct as win is undefined.

 

var win = new Window('dialog')
win.grp2 = win.add('group');
win.select = win.grp2.add('button', undefined, 'Ok');
win.can = win.grp2.add('button', undefined, 'Cancel');
win.select.preferredSize = win.can.preferredSize = [70, 20];
win.can.onClick = function () {
    alert('Cancel Click')
    win.close();
}

win.select.onClick = function () {
    alert('OK Click')
    win.close();
}
win.show();

 

 Let us know if it resolves your query.

Best regards

Votes

Translate

Translate

Report

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
Participant ,
Jun 20, 2020 Jun 20, 2020

Copy link to clipboard

Copied

being honest I tried a few of the suggestions unsuccesfully and then thought I can do without a cancel button

Votes

Translate

Translate

Report

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
LEGEND ,
Jun 20, 2020 Jun 20, 2020

Copy link to clipboard

Copied

Anyway my method works.

Votes

Translate

Translate

Report

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
Community Expert ,
Jun 21, 2020 Jun 21, 2020

Copy link to clipboard

Copied

LATEST

Your method always works 😊

Best regards

Votes

Translate

Translate

Report

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