irigsoft Posted January 22 Share Posted January 22 9 minutes ago, snow said: is there any way to catch the pressed key with this event? of course https://www.w3schools.com/jsref/obj_keyboardevent.asp and all on ClientEvents.ExtEvents : Quote Link to comment Share on other sites More sharing options...
snow Posted January 22 Author Share Posted January 22 I changed TabStop to false for both Controls in the sample project above. Inside TUniComboBox it works, inside TUniEdit focus still changes to the next control (no key event is fired) when pressing the virtual button. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 22 Share Posted January 22 Are you testing on an Android device? Quote Link to comment Share on other sites More sharing options...
snow Posted January 22 Author Share Posted January 22 Yes, I'm testing on a Zebra scanner Quote Link to comment Share on other sites More sharing options...
snow Posted January 22 Author Share Posted January 22 22 minutes ago, irigsoft said: of course https://www.w3schools.com/jsref/obj_keyboardevent.asp and all on ClientEvents.ExtEvents : No, i meant the "blur" event... I've already tried with ExtEvent keypress... this doesn't fire either. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 22 Share Posted January 22 Need to analyze it again then. Perhaps gboard is not working correctly somehow, don't know. Quote Link to comment Share on other sites More sharing options...
snow Posted January 22 Author Share Posted January 22 16 minutes ago, Sherzod said: Are you testing on an Android device? Same on my Android mobile... not working. Quote Link to comment Share on other sites More sharing options...
snow Posted January 22 Author Share Posted January 22 With Samsung virtual keyboard it's just the same. Quote Link to comment Share on other sites More sharing options...
irigsoft Posted January 22 Share Posted January 22 31 minutes ago, Sherzod said: Need to analyze it again then. Perhaps gboard is not working correctly somehow, don't know. @snow and @Sherzod, maybe this will point some of solution or traubles https://stackoverflow.com/questions/58303424/onkeyup-doesnt-handle-enter-from-hard-keyboard Use dispatchKeyEvent to handle enter: override fun dispatchKeyEvent(event:KeyEvent):Boolean { if (event.getAction() === KeyEvent.ACTION_UP) { Toast.makeText(this,event.getKeyCode().toString(),Toast.LENGTH_SHORT).show() return true } } or https://www.outsystems.com/forums/discussion/33623/javascript-to-detect-enter-key-press-in-mobile-app/ document.getElementById("Input_TextVar") .addEventListener("keyup", function(event) { event.preventDefault(); if (event.keyCode === 13) { $actions.SearchMember(); } }); or https://www.outsystems.com/blog/posts/create-input-mask-for-mobile/ html: <input type="text" id="credit-card-mask" /> javascript: js ------ start var input = document.getElementById('credit-card-mask'), oldValue, regex = new RegExp(/^\d{0,16}$/g), mask = function(value) { var output = []; for(var i = 0; i < value.length; i++) { if(i !== 0 && i % 4 === 0) { output.push(" "); // add the separator } output.push(value[i]); } return output.join(""); }, unmask = function(value) {/^\d{0,16}$/g var output = value.replace(new RegExp(/[^\d]/, 'g'), ''); // Remove every non-digit character return output; }, keydownHandler = function(e) { oldValue = e.target.value; }, inputHandler = function(e) { var el = e.target, newValue = el.value ; newValue = unmask(newValue); if(newValue.match(regex)) { newValue = mask(newValue); el.value = newValue; } else { el.value = oldValue; } } ; input.addEventListener('keydown', keydownHandler ); input.addEventListener('input', inputHandler ); js ------- end declared android 11 bug: https://community.anytype.io/t/enter-key-doesnt-work-at-all-on-external-keyboards-on-android/1354/10 https://forum.jquery.com/portal/en/community/topic/how-to-get-a-enter-key-event-by-the-android 1 Quote Link to comment Share on other sites More sharing options...
Oliver Morsch Posted January 22 Share Posted January 22 https://stackoverflow.com/questions/72369349/google-chrome-101-on-android-shows-tab-key-on-soft-keyboard-instead-of-enter-for 1 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 22 Share Posted January 22 @snow 8 minutes ago, Oliver Morsch said: https://stackoverflow.com/questions/72369349/google-chrome-101-on-android-shows-tab-key-on-soft-keyboard-instead-of-enter-for function afterrender(sender, eOpts) { sender.inputEl.dom.setAttribute('enterkeyhint', 'done'); } 1 Quote Link to comment Share on other sites More sharing options...
snow Posted January 23 Author Share Posted January 23 16 hours ago, Sherzod said: @snow function afterrender(sender, eOpts) { sender.inputEl.dom.setAttribute('enterkeyhint', 'done'); } Thank you so much... that did the trick!!! Thanks to everyone involved for your support. Greatly appreciated!!! 1 Quote Link to comment Share on other sites More sharing options...
irigsoft Posted January 23 Share Posted January 23 17 hours ago, Sherzod said: @snow function afterrender(sender, eOpts) { sender.inputEl.dom.setAttribute('enterkeyhint', 'done'); } Is it possible (and how) set this property with uniSession.AddJS () ? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 23 Share Posted January 23 5 minutes ago, irigsoft said: Is it possible (and how) set this property with uniSession.AddJS () ? In what place exactly? Quote Link to comment Share on other sites More sharing options...
irigsoft Posted January 23 Share Posted January 23 8 minutes ago, Sherzod said: In what place exactly? In my case I want to click some button on the form and it will change the property of the text field. I will do that with addJS (if is possible). I will leave the functionality of the stock Android keyboard, but when I need to, I will change this property of the text field 'enterkeyhint' 'done' Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 23 Share Posted January 23 19 minutes ago, irigsoft said: In my case I want to click some button on the form and it will change the property of the text field. I will do that with addJS (if is possible). For example: procedure TMainForm.UniButton1Click(Sender: TObject); begin UniSession.AddJS(UniEdit1.JSName + '.inputEl.dom.setAttribute("enterkeyhint", "done");'); end; https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/enterkeyhint 1 Quote Link to comment Share on other sites More sharing options...
irigsoft Posted January 23 Share Posted January 23 3 minutes ago, Sherzod said: procedure TMainForm.UniButton1Click(Sender: TObject); begin UniSession.AddJS(UniEdit1.JSName + '.inputEl.dom.setAttribute("enterkeyhint", "done");'); end; Thanks. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.