Link in Zwischenablage kopieren
Kopiert
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.
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
Link in Zwischenablage kopieren
Kopiert
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;
Link in Zwischenablage kopieren
Kopiert
Thx.
That does appear to make all corners square.
Link in Zwischenablage kopieren
Kopiert
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
Link in Zwischenablage kopieren
Kopiert
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....
Link in Zwischenablage kopieren
Kopiert
Thx.
Goes away, bangs head on wall, feels better ... when I stopped!
Link in Zwischenablage kopieren
Kopiert
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"} );
Weitere Inspirationen, Events und Ressourcen finden Sie in der neuen Adobe Community
Jetzt ansehen