You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2020/01/10 20:03:07 UTC

[royale-asjs] branch develop updated: block all input if focus is assigned to a disabled TextInput. Should fix #663

This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new d69b4d2  block all input if focus is assigned to a disabled TextInput.  Should fix #663
d69b4d2 is described below

commit d69b4d29c354555c0a5fcf9c67ceb768fad46906
Author: Alex Harui <ah...@apache.org>
AuthorDate: Fri Jan 10 12:02:49 2020 -0800

    block all input if focus is assigned to a disabled TextInput.  Should fix #663
---
 .../MXRoyale/src/main/royale/mx/controls/TextInput.as      | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/TextInput.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/TextInput.as
index 63dec3b..c6063f6 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/TextInput.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/TextInput.as
@@ -365,12 +365,26 @@ public class TextInput extends UIComponent implements ITextInput
 		}
 		
 		_disableBead.disabled = !value;
+        
+        COMPILE::JS {
+            if (value)
+                element.removeEventListener("keypress", blockInput);
+            else
+                element.addEventListener("keypress", blockInput);
+        }
 		
 		COMPILE::SWF {
 			var textView:TextInputView = view as TextInputView;
 			textView.textField.mouseEnabled = super.enabled;
 		}
     }
+    
+    COMPILE::JS
+    private function blockInput(event:Event):void
+    {
+        event["returnValue"] = false;
+        if (event.preventDefault) event.preventDefault();        
+    }
 
     //----------------------------------
     //  tabIndex