Procházet zdrojové kódy

UITextInput now shows caret immediately when focus is gained

Ivan Safrin před 10 roky
rodič
revize
5e8fa4f035

+ 2 - 0
Modules/Contents/UI/Include/PolyUITextInput.h

@@ -363,6 +363,8 @@ namespace Polycode {
             void convertIndentToSpaces();
 			
 			void doMultilineResize();
+        
+            virtual void onGainFocus();
 						
 			static void setMenuSingleton(UIGlobalMenu *_globalMenu);
 					

+ 5 - 0
Modules/Contents/UI/Source/PolyUITextInput.cpp

@@ -2610,6 +2610,11 @@ void UITextInput::handleEvent(Event *event) {
     UIElement::handleEvent(event);
 }
 
+void UITextInput::onGainFocus() {
+    blinkerRect->visible  = true;
+    blinkTimer->Reset();
+}
+
 void UITextInput::shiftText(bool left) {
 	if (multiLine && (hasSelection || lines[lineOffset].text != "")) {
 		saveUndoState();