1】UniMemo控制行距
.x-form-text-default .x-form-textarea{ //说明 这两个属性要同时修改 line-height: 30px; }
设置这个 line-height就可以了
UniSession.AddJS(UniMemo1.JSName+'.focus();');
BorderStyle设为ubsNone
unimemo1.EmptyText:='blank空白';
5]用代码实现在当前位置插入字符串,当然用Ctrl+V也能实现
5. 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); }
5.2. Use like this:
procedure TMainForm.UniButton1Click(Sender: TObject); begin UniMemo1.JSInterface.JSCall('insertAtCursor', ['添加文本']); end;
procedure TMainForm.UniButton2Click(Sender: TObject); begin unisession.AddJS('MainForm.UniMemo1.setValue(''line1\nline2\nline3'')'); // UniMemo1.Lines.Text:='line1'#13#10'line2'#13#10'line3'; end;