Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread SelectAll on a TMultiLineEdit
Fri, Apr 8 2016 9:17 AMPermanent Link

Matthew Jones

I can't seem to get SelectAll to work on a TMultiLineEdit. It works
fine for TEdit. Tabbing, which calls it, also works on the TEdit, but
not TMultilineEdit. The only thing I can see about textarea and
SelectAll on StackOverflow seems to be about ensuring it exists in the
DOM, and it plainly does.

Anyone know the solution?

--

Matthew Jones
Mon, Apr 11 2016 5:25 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

<< I can't seem to get SelectAll to work on a TMultiLineEdit. It works fine for TEdit. Tabbing, which calls it, also works on the TEdit, but not TMultilineEdit. The only thing I can see about textarea and SelectAll on StackOverflow seems to be about ensuring it exists in the DOM, and it plainly does. >>

EWB specifically ignores SelectAll for multi-line edit controls.  The fix is to get rid of this:

WebUI unit:

procedure TInputElement.SelectAll;
begin
  with THTMLInputElement(DOMElement) do
     begin
     if SameText(type,HTML_VALUE_TEXT) or SameText(type,HTML_VALUE_PASSWORD) then  <<< Remove !!!
        setSelectionRange(0,Length(InputValue));
     end;
end;

But, you'll get a SelectAll every time the multi-line edit control obtains focus, which may or may not be what you want.

Tim Young
Elevate Software
www.elevatesoft.com
Mon, Apr 11 2016 8:02 AMPermanent Link

Matthew Jones

Tim Young [Elevate Software] wrote:

> But, you'll get a SelectAll every time the multi-line edit control
> obtains focus, which may or may not be what you want.

Hmm, presumably I could change the higher level too. Hmm, will have to
think about this. The condition there is to prevent the automatic
selection on entry, and it would be good to have that test at a higher
level and a way to force it if wanted.

I think if I change it, then I'd add a SelectAllForce and make that
accessible. Then the existing behaviour stays, and I can manually do
what is needed. In my case, I want to select all when it is the
default. Thanks for the details.

--

Matthew Jones
Tue, Apr 12 2016 7:39 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

<< Hmm, presumably I could change the higher level too. Hmm, will have to think about this. The condition there is to prevent the automatic selection on entry, and it would be good to have that test at a higher level and a way to force it if wanted. >>

I've made a note to change this in 2.05, so you'll still be able to *call* SelectAll without the automatic select-all behavior on focus for multi-line edits.

Tim Young
Elevate Software
www.elevatesoft.com
Tue, Apr 12 2016 8:01 AMPermanent Link

Matthew Jones

Tim Young [Elevate Software] wrote:

> I've made a note to change this in 2.05, so you'll still be able to
> call SelectAll without the automatic select-all behavior on focus for
> multi-line edits.

Perfect, thank you.

--

Matthew Jones
Image