Jump to content

Recommended Posts

Posted
11 minutes ago, Andrew Spencer said:

Is there a way to programatically select all of the text in a TUniDBMemo?

For example:

procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  UniDBMemo1.JSInterface.JSCall('execCmd', ['selectAll']);
end;

 

Posted
13 hours ago, Andrew Spencer said:

Unfortunately this results in

image.png.a4ca7c327f0c0870da52aaa946ea6cb1.png

One possible solution:

UniDBMemo.ClientEvents.ExtEvents ->

function afterrender(sender, eOpts) 
{
    sender.selectAll = function() {
        var textarea = sender.inputEl.dom;

        var text = textarea.value;
        var start = 0;
        var end = text.length;

        textarea.setSelectionRange(start, end);
        textarea.focus();
    };
}

Usage:

procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  UniDBMemo1.JSInterface.JSCall('selectAll', ['']);
end;

 

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