Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Commit

Permalink
Fixed issue where text input wouldn't focus
Browse files Browse the repository at this point in the history
Thanks to Abynim (https://github.com/abynim) for the solution.
  • Loading branch information
rodi01 committed Sep 25, 2016
1 parent 61b2980 commit 5c4cca4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
12 changes: 9 additions & 3 deletions Rename It.sketchplugin/Contents/Sketch/findReplace.sketchscript
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ function createDialog()
{
var alert = COSAlertWindow.new();

function createTextFieldWithLavel(label,defaultValue) {
function createTextFieldWithLabel(label,defaultValue) {
alert.addTextLabelWithValue(label);
alert.addTextFieldWithValue(defaultValue);
}
Expand All @@ -11,10 +11,16 @@ function createDialog()
alert.setInformativeText("Find and replace text in the selected layer(s) * CASE SENSITIVE *");

// Name
createTextFieldWithLavel("Find:","");
createTextFieldWithLabel("Find:","");
var firstField = alert.viewAtIndex(1)

// Interator
createTextFieldWithLavel("Replace with:","");
createTextFieldWithLabel("Replace with:","");
var secondField = alert.viewAtIndex(3)

// Set first responder
alert.alert().window().setInitialFirstResponder(firstField)
firstField.setNextKeyView(secondField)

// Actions buttons.
alert.addButtonWithTitle('OK');
Expand Down
12 changes: 9 additions & 3 deletions Rename It.sketchplugin/Contents/Sketch/renameIt.sketchscript
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function createDialog()
{
var alert = COSAlertWindow.new();

function createTextFieldWithLavel(label,defaultValue) {
function createTextFieldWithLabel(label,defaultValue) {
alert.addTextLabelWithValue(label);
alert.addTextFieldWithValue(defaultValue);
}
Expand All @@ -101,10 +101,16 @@ function createDialog()
alert.setInformativeText("Helpers: \nNumber Sequence: %N or %n \nDimensions: %W %H \nMove Original Layer Name: *");

// Name
createTextFieldWithLavel("Name:","");
createTextFieldWithLabel("Name:","");
var firstField = alert.viewAtIndex(1)

// Interator
createTextFieldWithLavel("Starts Number Sequence From:","1");
createTextFieldWithLabel("Starts Number Sequence From:","1");
var secondField = alert.viewAtIndex(3)

// Set first responder
alert.alert().window().setInitialFirstResponder(firstField)
firstField.setNextKeyView(secondField)

// Actions buttons.
alert.addButtonWithTitle('OK');
Expand Down

0 comments on commit 5c4cca4

Please sign in to comment.