Browse Source

Demonstrating how the auto-focus needs to be removed from the tb.txt file and programatically set in the TS so that the field gets auto-selected

Shaddock Heath 9 years ago
parent
commit
b3267990cc

+ 1 - 1
Resources/EditorData/AtomicEditor/editor/ui/createproject.tb.txt

@@ -3,7 +3,7 @@ TBLayout: axis: y, distribution: gravity, position: left
 		TBLayout: distribution: gravity
 		TBLayout: distribution: gravity
 			TBTextField: text: "Project Name:"
 			TBTextField: text: "Project Name:"
 			TBLayout: gravity: left right, distribution-position: right bottom
 			TBLayout: gravity: left right, distribution-position: right bottom
-				TBEditField: id: project_name, text: "MyGame", autofocus: 1
+				TBEditField: id: project_name, text: "MyGame"
 					lp: min-width: 240
 					lp: min-width: 240
 		TBLayout: gravity: left right, distribution-position: right bottom
 		TBLayout: gravity: left right, distribution-position: right bottom
 			TBImageWidget: id: project_image
 			TBImageWidget: id: project_image

+ 3 - 0
Script/AtomicEditor/ui/modal/CreateProject.ts

@@ -64,6 +64,9 @@ class CreateProject extends ModalWindow {
         this.projectPathField.text = userDocuments;
         this.projectPathField.text = userDocuments;
         this.populateLanguageSelectionList();
         this.populateLanguageSelectionList();
 
 
+        // Need to manually set the focus so the contents get auto-selected
+        this.projectNameField.setFocus();
+
         this.resizeToFitContent();
         this.resizeToFitContent();
         this.center();
         this.center();