// Called when the user pressed the left arrow protected virtual void onKeyLeft(KeyboardState keyboard) { if(pCursorPos> 0) pCursorPos--; if(keyboard.isKeyUp(KKL.SHIFT)) cursorEnd= pCursorPos; }
// Called when the user presses the right arrow protected virtual void onKeyRight(KeyboardState keyboard) { if(pCursorPos< pText.Length) cursorPos++; if(keyboard.isKeyUp(KKL.SHIFT)) cursorEnd= pCursorPos; }
// Called whenever the keyboard has been pressed protected virtual void onKeyboardPress(GUIControl control, KeyboardState keyboard) { if(tick< tickMax) tick++; else { tick= 0; for(int i= 0; i< keyboard.keysPressed.Length; i++) { switch((KKL)(keyboard.keysPressed[i])) { case KKL.RIGHT: onKeyRight(keyboard); break; case KKL.LEFT: onKeyLeft(keyboard); break; case KKL.BACKSPACE: onBackspace(); break; case KKL.DELETE: onDelete(); break; } if(keyboard.keysPressed[i]>= 65 && keyboard.keysPressed[i]<= 90) insertText(((char)(keyboard.keysPressed[i])).ToString()); } } }