![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 6 of 6 total |
![]() |
Thu, Nov 16 2017 5:30 AM | Permanent Link |
Matthew Jones | Just a thought on this, but I get the impression that this doesn't work if you set the content and then call it. I suspect this is because the DOM hasn't been updated yet, and so there is nothing to select, or it gets cleared. But I have an OnEnter which changes the text (when not in, it shows values with things like currency or percent signs, when editing, it removes them and goes full precision) and SelectAll doesn't work. But doing edit.SelectStart := 0; edit.SelectEnd := Length(myContent); works fine.
-- Matthew Jones |
Thu, Nov 16 2017 1:09 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Matthew,
<< Just a thought on this, but I get the impression that this doesn't work if you set the content and then call it. I suspect this is because the DOM hasn't been updated yet, and so there is nothing to select, or it gets cleared. But I have an OnEnter which changes the text (when not in, it shows values with things like currency or percent signs, when editing, it removes them and goes full precision) and SelectAll doesn't work. But doing edit.SelectStart := 0; edit.SelectEnd := Length(myContent); works fine. >> SelectAll does exactly that: procedure TInputElement.SelectAll; begin if (Self=InterfaceManager.ActiveElement) then THTMLInputElement(DOMElement).setSelectionRange(0,Length(InputValue)); end; However, you'll notice that it does a check on the focused element first. That may be what is tripping you up, but I would have to investigate this further to be sure. Tim Young Elevate Software www.elevatesoft.com |
Fri, Nov 17 2017 3:32 AM | Permanent Link |
Matthew Jones | Tim Young [Elevate Software] wrote:
> SelectAll does exactly that: Hah! I didn't click the further call when I chased it down as I presumed it was a "native DOM" thing. I suspect that you are right in the focus issue - OnEnter may not know it is the new focus I guess. Is there a reason it can't select all for anything? Why can't I selectAll in a hundred edits at the same time? -- Matthew Jones |
Tue, Nov 21 2017 1:21 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Matthew,
<< Hah! I didn't click the further call when I chased it down as I presumed it was a "native DOM" thing. I suspect that you are right in the focus issue - OnEnter may not know it is the new focus I guess. Is there a reason it can't select all for anything? Why can't I selectAll in a hundred edits at the same time? >> It actually *is* a native DOM thing - an input element must have focus before you can manipulate the selection ranges for the input element. Tim Young Elevate Software www.elevatesoft.com |
Mon, Nov 27 2017 1:25 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Matthew,
<< Just a thought on this, but I get the impression that this doesn't work if you set the content and then call it. I suspect this is because the DOM hasn't been updated yet, and so there is nothing to select, or it gets cleared. But I have an OnEnter which changes the text (when not in, it shows values with things like currency or percent signs, when editing, it removes them and goes full precision) and SelectAll doesn't work. But doing edit.SelectStart := 0; edit.SelectEnd := Length(myContent); works fine. >> I can't reproduce what you're seeing here. I'm doing this: procedure TForm1.Edit1Enter(Sender: TObject); begin Edit1.Text:='Hello World'; Edit1.SelectAll; end; and it works fine, selecting all of the text. If you want to send me something more specific, I can test it out here and see what's going on. Tim Young Elevate Software www.elevatesoft.com |
Tue, Nov 28 2017 4:23 AM | Permanent Link |
Matthew Jones | Tim Young [Elevate Software] wrote:
> I can't reproduce what you're seeing here. Hmm, okay, I will dig into it further. -- Matthew Jones |
This web page was last updated on Monday, September 25, 2023 at 03:00 PM | Privacy Policy![]() © 2023 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |