likemike Posted January 7, 2022 Share Posted January 7, 2022 Hello! If I try to add a string to UnimMemo, 2 linefeeds are added: UnimMemo1.Text:='Hello!'; UnimMemo1.Text:=UnimMemo1.Text+'Test'; The result is: Quote Hello! Test <cursor is here> So I tried this solution: But this doesn't work with UnimMemo (Ajax error: undefined is not an object (evaluating 'Ext.form.field.TextArea.prototype') ) Link to comment Share on other sites More sharing options...
Sherzod Posted January 7, 2022 Share Posted January 7, 2022 1 hour ago, likemike said: But this doesn't work with UnimMemo (Ajax error: undefined is not an object (evaluating 'Ext.form.field.TextArea.prototype') ) Yes, the solution above was for the desktop version. Link to comment Share on other sites More sharing options...
Sherzod Posted January 8, 2022 Share Posted January 8, 2022 8 hours ago, likemike said: But this doesn't work with UnimMemo (Ajax error: undefined is not an object (evaluating 'Ext.form.field.TextArea.prototype') ) You can try this modified code for the mobile version. Ext.form.TextArea.prototype.insertAtCursor = function(txt) { var val = this.getValue(), start = this.inputElement.dom.selectionStart, end = this.inputElement.dom.selectionEnd; this.setValue(val.substring(0, start) + txt + val.substring(end)); this.inputElement.dom.selectionStart = this.inputElement.dom.selectionEnd = start + txt.length; Ext.defer(function() { this.focus(false); }, 10); } Link to comment Share on other sites More sharing options...
likemike Posted January 8, 2022 Author Share Posted January 8, 2022 Hello! That works. Thank you! But why is it necessary to do such (normally) easy things so complicated? Isn't it only a bug in UnimMemo where unwanted linefeeds are added? Link to comment Share on other sites More sharing options...
Sherzod Posted January 8, 2022 Share Posted January 8, 2022 19 minutes ago, likemike said: But why is it necessary to do such (normally) easy things so complicated? 5 hours ago, Sherzod said: Ext.form.TextArea.prototype.insertAtCursor = function(txt) { var val = this.getValue(), start = this.inputElement.dom.selectionStart, end = this.inputElement.dom.selectionEnd; this.setValue(val.substring(0, start) + txt + val.substring(end)); this.inputElement.dom.selectionStart = this.inputElement.dom.selectionEnd = start + txt.length; Ext.defer(function() { this.focus(false); }, 10); } Well, actually this is for a another case. This solution is suitable for your case: 13 hours ago, likemike said: UnimMemo1.Text:='Hello!'; UnimMemo1.Text:=UnimMemo1.Text+'Test'; UnimMemo1.Text := 'Hello!'; UnimMemo1.Text := TrimRight(UnimMemo1.Text) + 'Test'; Link to comment Share on other sites More sharing options...
likemike Posted January 8, 2022 Author Share Posted January 8, 2022 Sorry - you misunderstand me. I mean, why does this not work? UnimMemo1.Text:=UnimMemo1.Text+'Test'; Why does this simple assignment add 2 unwanted linefeeds? Link to comment Share on other sites More sharing options...
Sherzod Posted January 8, 2022 Share Posted January 8, 2022 Ok, sorry. You can open a request in the support portal. Link to comment Share on other sites More sharing options...
Recommended Posts