Skip to content

Commit

Permalink
added insert text capability to TextField and TextEntryComponent, wit…
Browse files Browse the repository at this point in the history
…h updated cursor position
  • Loading branch information
AquariusPower committed Dec 4, 2016
1 parent 151f7d9 commit 972385c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/com/simsilica/lemur/TextField.java
Expand Up @@ -225,5 +225,9 @@ public float getPreferredLineCount() {
public String toString() {
return getClass().getName() + "[text=" + getText() + ", color=" + getColor() + ", elementId=" + getElementId() + "]";
}

public void insertText(String str){
text.insertText(str);
}
}

Expand Up @@ -747,4 +747,12 @@ public void guiUpdate( GuiControl source, float tpf ) {
}
}
}

public void insertText(String str){
for(int i=0;i<str.length();i++){
model.insert(str.charAt(i));
}

resetCursorPosition();
}
}

0 comments on commit 972385c

Please sign in to comment.