Beenden
  • Globale Community
    • Sprache:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티

Why do buttons in two panels have different corners

Engagiert ,
Nov 18, 2017 Nov 18, 2017

The following working code creates two 'identical' buttons in two separate panels in a single dialog box.

The buttons in the upper panel are shown with rounded corners, those in the lower panel are shown with square corners.

Can anyone please explain why; and also how the same (rounded or square) corners may be achieved for buttons in both panels.

    var box = new Window( 'dialog', "Test corners of buttons" );

    box.panel1 = box.add( 'panel', undefined, "" );

   

    box.panel1_cancelBtn = box.panel1.add( 'button', undefined, "Cancel" );

    box.panel1_createBtn = box.panel1.add( 'button', undefined, "Create" );

    box.panel2 = box.add( 'panel', undefined, "" );

   

    box.panel2_cancelBtn = box.panel2.add( 'button', undefined, "Cancel" );

    box.panel2_saveBtn = box.panel2.add( 'button', undefined, "Save" );

   

    box.panel1_cancelBtn.onClick = function() { box.close() };

    box.panel2_cancelBtn.onClick = function() { box.close() };

    box.show();

For information only, the code has been greatly simplified from a lengthy and complex function [that otherwise works to my satisfaction] that creates a dialog box with some initially inactive panels that are individually activated by clicking an 'OK' button in an active panel.  The other code in the function is not relevant, that shown above demonstrates the issue.

The behaviour is observed in ESTK / PS CC 2018 (19.0) under both Windows10 and High Sierra.

It's not a big issue, but the lack of visual consistency irritates me, as does my lack of understanding as to why there is a difference.

THEMEN
Aktionen und Skripte
1.7K
Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines

correct answers 1 richtige Antwort

Community Expert , Nov 18, 2017 Nov 18, 2017

It's a known bug – ok / cancel buttons turn everything in the same group/panel rounded corners. Apparently, it works one time only, i.e. only one Cancel in your window is able to "roundify" corners. But if you use ok, as in the following snip, both are rounds.

var box = new Window( 'dialog', "Test corners of buttons" );

box.panel1 = box.add( 'panel', undefined, "" );

box.panel1_cancelBtn = box.panel1.add( 'button', undefined, "Cancel" );

box.panel1_createBtn = box.panel1.add( 'button', undefined, "C

...
Übersetzen
Adobe
Populärer Benutzer ,
Nov 18, 2017 Nov 18, 2017

It's cool. )

Another bug (or feature) of CC. This is likely due to the fact that you use the reserved names Cancel or OK. Then the style of the buttons changes.


Before

     box.show ();

insert two lines

     box.cancelElement = null;
     box.defaultElement = null;

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Engagiert ,
Dec 03, 2017 Dec 03, 2017

Thx.

That does appear to make all corners square.

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Community Expert ,
Nov 18, 2017 Nov 18, 2017

It's a known bug – ok / cancel buttons turn everything in the same group/panel rounded corners. Apparently, it works one time only, i.e. only one Cancel in your window is able to "roundify" corners. But if you use ok, as in the following snip, both are rounds.

var box = new Window( 'dialog', "Test corners of buttons" );

box.panel1 = box.add( 'panel', undefined, "" );

box.panel1_cancelBtn = box.panel1.add( 'button', undefined, "Cancel" );

box.panel1_createBtn = box.panel1.add( 'button', undefined, "Create" );

box.panel2 = box.add( 'panel', undefined, "" );

// ok here turns round the corners as well

box.panel2_cancelBtn = box.panel2.add( 'button', undefined, "Cancel" );

box.panel2_saveBtn = box.panel2.add( 'button', undefined, "ok" );

box.panel1_cancelBtn.onClick = function() { box.close() };

box.panel2_cancelBtn.onClick = function() { box.close() };

box.show();

Davide

Davide Barranca - PS developer and author
www.ps-scripting.com
Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Community Expert ,
Nov 18, 2017 Nov 18, 2017

Also depends on the ScriptUI version used by Photoshop.  Versions cc 2014 and before will all have square corners.  There are many bugs in Photoshop.  My preferred version is CC 2014....

JJMack
Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Engagiert ,
Dec 03, 2017 Dec 03, 2017
AKTUELL

Thx.

Goes away, bangs head on wall, feels better ... when I stopped!

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Engagiert ,
Dec 03, 2017 Dec 03, 2017

Thx.

Adding ' {name: "ok"} ' to line 12 has the (same) effect of making all corners rounded:

box.panel2_saveBtn = box.panel2.add( 'button', undefined, "Save", {name: "ok"} );

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines