Jump to content

Unicode / two UniMemo ?


Abaksoft

Recommended Posts

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

  • Like 1
  • Upvote 1
Link to comment
Share on other sites

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();                 
    }                  
}

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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);
}

 

  • Like 1
  • Upvote 2
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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;
    ...

 

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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;

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...