Abaksoft Posted January 27, 2020 Share Posted January 27, 2020 Good morning Sirs, - I have two UniMemo on mainForm - One for English text editing and one for Arabic. - No need internationalization components here. Just changing Font (ENg / Arabic) for editing. Someone has an idea ? Big Thx... ______________________ See attachment Project1 Unicode_ENG_ARABIC.zip Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 27, 2020 Share Posted January 27, 2020 14 minutes ago, Abaksoft said: Just changing Font (ENg / Arabic) for editing Hi, Can you please explain this moment? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 27, 2020 Share Posted January 27, 2020 If you want to change the keyboard layout on the client side, you won't be able to do it. "But you can capture the keydown event and replace the character with something like this": https://jsfiddle.net/xpvt214o/430815/ https://stackoverflow.com/questions/51367824/change-input-text-language-at-focus-if-rtl https://stackoverflow.com/questions/11426969/change-keyboard-layout-with-javascript 1 1 Quote Link to comment Share on other sites More sharing options...
Abaksoft Posted January 27, 2020 Author Share Posted January 27, 2020 Thank you Maestro, That is exactly what i am looking for. All the Best...:) 1 Quote Link to comment Share on other sites More sharing options...
Abaksoft Posted January 27, 2020 Author Share Posted January 27, 2020 Sorry Sherzod, How to return a letter like this : function keydown(sender, e, eOpts) { if( e.keyCode == 89 ){ e.preventDefault(); // $(this).append('غ').focus(); return 'غ' } } Here, i want to change the y letter by غ not work ! Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 27, 2020 Share Posted January 27, 2020 Ok I will check. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 27, 2020 Share Posted January 27, 2020 2 hours ago, Abaksoft said: Here, i want to change the y letter by غ Sorry, maybe this is not the best solution, but try. 1. MainForm -> Script, add this: Ext.form.field.TextArea.prototype.insertAtCursor = function(txt) { var val = this.value, start = this.inputEl.dom.selectionStart, end = this.inputEl.dom.selectionEnd; this.setValue(val.substring(0, start) + txt + val.substring(end)); this.inputEl.dom.selectionStart = this.inputEl.dom.selectionEnd = start + 1; Ext.defer(function() { this.focus(false); }, 10); } http://forums.unigui.com/index.php?/topic/10678-unimemo-insert-text/&do=findComment&comment=56242 2. UniMemo.ClientEvents.ExtEvents -> function keydown(sender, e, eOpts) { if( e.keyCode == 89 ){ this.insertAtCursor('غ'); e.preventDefault(); } } Quote Link to comment Share on other sites More sharing options...
Abaksoft Posted January 27, 2020 Author Share Posted January 27, 2020 Thank you Maestro for your effort. i will check it tomorrow... Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 27, 2020 Share Posted January 27, 2020 7 minutes ago, Abaksoft said: i will check it tomorrow... OK, np. Thanks Quote Link to comment Share on other sites More sharing options...
Abaksoft Posted January 28, 2020 Author Share Posted January 28, 2020 Good morning Sherzod, Sorry, when i put the Script on Main -> no launch application "Loading..." !? Ext.form.field.TextArea.prototype.insertAtCursor = function(txt) { var val = this.value, start = this.inputEl.dom.selectionStart, end = this.inputEl.dom.selectionEnd; this.setValue(val.substring(0, start) + txt + val.substring(end)); this.inputEl.dom.selectionStart = this.inputEl.dom.selectionEnd = start + 1; Ext.defer(function() { this.focus(false); }, 10); } any idea ? ____________________________________________________ FMSoft_uniGUI_Complete_Professional_1.90.0.1514 Delphi 10.3.3 Pro Windows 10 Pro 64/bit Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 28, 2020 Share Posted January 28, 2020 1 hour ago, Abaksoft said: when i put the Script on Main -> MainForm.Script ? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 28, 2020 Share Posted January 28, 2020 1 hour ago, Abaksoft said: no launch application "Loading..." !? Please check your browser console, what errors do you see? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 28, 2020 Share Posted January 28, 2020 Try this: Ext.form.field.TextArea.prototype.insertAtCursor = function(txt) { var val = this.value, start = this.inputEl.dom.selectionStart, end = this.inputEl.dom.selectionEnd; this.setValue(val.substring(0, start) + txt + val.substring(end)); this.inputEl.dom.selectionStart = this.inputEl.dom.selectionEnd = start + 1; Ext.defer(function() { this.focus(false); }, 10); } 1 2 Quote Link to comment Share on other sites More sharing options...
Abaksoft Posted January 28, 2020 Author Share Posted January 28, 2020 That works fine Maestro ! Thank you very much 1 Quote Link to comment Share on other sites More sharing options...
Abaksoft Posted February 1, 2020 Author Share Posted February 1, 2020 Hello Sherzod, Is it possible to retreive a variable (from MainForm) and get it on an UniMemo > ClientEvents > ExtVents (keydown) ? Some thing like : function keydown(sender, e, eOpts) { var W=Main.MainForm.myVariable; if (W == 2) { Do something... } } Thx. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 1, 2020 Share Posted February 1, 2020 Yes... Have you tried? Quote Link to comment Share on other sites More sharing options...
Abaksoft Posted February 1, 2020 Author Share Posted February 1, 2020 yes, without success Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 1, 2020 Share Posted February 1, 2020 8 hours ago, Abaksoft said: Main.MainForm.myVariable; Or do you mean like this? For example: procedure TMainForm.UniFormCreate(Sender: TObject); begin Self.WebForm.JSInterface.JSAssign('myVariable', [0]); end; procedure TMainForm.SetMyVariable... begin ... Self.WebForm.JSInterface.JSAssign('myVariable', [Value]); ... end; function keydown(sender, e, eOpts) { var W=MainForm.window.myVariable; ... Quote Link to comment Share on other sites More sharing options...
Abaksoft Posted February 2, 2020 Author Share Posted February 2, 2020 16 hours ago, Sherzod said: Or do you mean like this? For example: procedure TMainForm.UniFormCreate(Sender: TObject); begin Self.WebForm.JSInterface.JSAssign('myVariable', [0]); end; procedure TMainForm.SetMyVariable... begin ... Self.WebForm.JSInterface.JSAssign('myVariable', [Value]); ... end; function keydown(sender, e, eOpts) { var W=MainForm.window.myVariable; ... Good morning Sherzod, Yes like this, but I would not abuse your kindness : it does'nt work ?! Here is in attachment a test case. (It's not urgent) Thx. Test_Variable.zip Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 2, 2020 Share Posted February 2, 2020 57 minutes ago, Abaksoft said: Yes like this, but I would not abuse your kindness : it does'nt work ?! Hi, var W = Mainform.window.myVariable; // <--- is not recognized here !? As you know, JS is case sensitive. Correct: Mainform -> MainForm var W = MainForm.window.myVariable; Quote Link to comment Share on other sites More sharing options...
Abaksoft Posted February 2, 2020 Author Share Posted February 2, 2020 Greate Support Maestro ! Works fine (Every time I forget JavaScript CaseSensitive). Thank you very much and sorry again for your week end rest. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 3, 2020 Share Posted February 3, 2020 Thank you, it was all OK. Quote Link to comment Share on other sites More sharing options...
Abaksoft Posted February 3, 2020 Author Share Posted February 3, 2020 For all unigueers who are interested, there is a sample demo in : Best regards 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.