Jean-Marc Kiener Posted September 5, 2016 Posted September 5, 2016 Hi experts, I try to build a form who let the user edit data from a database. I figured it out ( thanks to this forum :-) ) how to configure F1..F8 Keys so i can handle it exclusively in my app (the browser ignores them). The form property monitoredkeys stuff does the job. Great! Now i want do this with Ctrl+S, Ctrl+D, Ctrl+E etc. Is this possible? Quote
Sherzod Posted September 5, 2016 Posted September 5, 2016 Hi, For now try this: 1. MainForm->ClientEvents->UniEvents: window.afterCreate fn: function window.afterCreate(sender) { Ext.onReady(function() { document.onkeydown = function(e) { e = e || window.event; if (e.ctrlKey) { var c = e.which || e.keyCode; switch (c) { case 68: // D case 69: // E case 83: // S ajaxRequest(sender.uform, "ctrlkey", ["keycode=" + c]); e.preventDefault(); e.stopPropagation(); break; } } }; }) } 2. MainForm->onAjaxEvent: procedure TMainForm.UniFormAjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); begin if EventName = 'ctrlkey' then begin if Params.Values['keycode'] = '83' then begin ShowMessage('Ctrl+S'); end; end; end; Best regards Quote
Jean-Marc Kiener Posted September 9, 2016 Author Posted September 9, 2016 Hi Delphi Developer, Thanks for your replay. Sorry for the delay. I will test it out as soon i have time. Very busy days... Quote
Jean-Marc Kiener Posted September 13, 2016 Author Posted September 13, 2016 Works very well, thankyou! A key combination who does not work in firefox is Ctrl + N. This shortkey will always open a new firefox windows. Th OnAjaxEvent get never called. Quote
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.