Jump to content

uniMemo Insert text


viaboleto

Recommended Posts

I think that would be more correct:

Ext.form.field.TextArea.prototype.insertAtCursorUniMemo = 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 + txt.length;
    this.inputEl.focus(false);
};

Ext.form.field.TextArea.prototype.deleteAtCursorUniMemo = function(txt2) {
    var val = this.getValue(),
        start = this.inputEl.dom.selectionStart,
        end = this.inputEl.dom.selectionEnd;

    this.setValue(val.substring(0, start - 1) + val.substring(end));
    this.inputEl.dom.selectionStart = this.inputEl.dom.selectionEnd = start - 1;
    this.inputEl.focus(false);
};

Ext.form.Text.prototype.insertAtCursorUniEdit = function(txt) {
    var val = this.getValue(),
        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 + txt.length;
    this.inputEl.focus(false);
};

Ext.form.Text.prototype.deleteAtCursorUniEdit = function(txt2) {
    var val = this.getValue(),
        start = this.inputEl.dom.selectionStart,
        end = this.inputEl.dom.selectionEnd;

    this.setValue(val.substring(0, start - 1) + val.substring(end));
    this.inputEl.dom.selectionStart = this.inputEl.dom.selectionEnd = start - 1;
    this.inputEl.focus(false);
};

 

  • Thanks 1
Link to comment
Share on other sites

5 minutes ago, Sherzod said:

I think that would be more correct:

Ext.form.field.TextArea.prototype.insertAtCursorUniMemo = 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 + txt.length;
    this.inputEl.focus(false);
};

Ext.form.field.TextArea.prototype.deleteAtCursorUniMemo = function(txt2) {
    var val = this.getValue(),
        start = this.inputEl.dom.selectionStart,
        end = this.inputEl.dom.selectionEnd;

    this.setValue(val.substring(0, start - 1) + val.substring(end));
    this.inputEl.dom.selectionStart = this.inputEl.dom.selectionEnd = start - 1;
    this.inputEl.focus(false);
};

Ext.form.Text.prototype.insertAtCursorUniEdit = function(txt) {
    var val = this.getValue(),
        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 + txt.length;
    this.inputEl.focus(false);
};

Ext.form.Text.prototype.deleteAtCursorUniEdit = function(txt2) {
    var val = this.getValue(),
        start = this.inputEl.dom.selectionStart,
        end = this.inputEl.dom.selectionEnd;

    this.setValue(val.substring(0, start - 1) + val.substring(end));
    this.inputEl.dom.selectionStart = this.inputEl.dom.selectionEnd = start - 1;
    this.inputEl.focus(false);
};

 

Works perfect!!!

Congratulations Sherzod and thank you so much for your support!

Here is the record for use on a virtual keyboard  made for Touch monitors that work in self-service Totems.image.png.4e533d52413b5f28724f8df3e789d56e.png

  • Like 1
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...