Re: setSelectionRange and friends



On May 30, 1:29 pm, Tim Streater <timstrea...@xxxxxxxxxxxx> wrote:
In article <4A20611C.50...@xxxxxxxxxxxxxx>,
 Thomas 'PointedEars' Lahn <PointedE...@xxxxxx> wrote:



Tim Streater wrote:
I'm aiming to replicate what Mac-Eudora does when you start to type in
an e-mail address into as it might be the To: field. If Eudora
recognises that you seem to be typing in a nickname that it can expand,
it:

1) completes the nickname and highlights the extra characters it has
entered

2) makes that whole nickname <strong>, or bold (but not the rest of the
To: line)

3) allows you to continue typing to complete the nickname or type a
comma to accept it and have it expanded

4) as you type, the highlighted area shrinks one char to the right at a
time

In thinking how I might do this, using onkeypress and onkeyup, I come
across setSelectionRange, startSelection and endSelection for use with a
textarea that I think might be useful in this context (found by some
amount of googling). But none of these is documented as far as I can
tell in for example Danny Goodman's or David Flanagan's JavaScript books.

Maybe because those books are junk, dumped in shelves by wannabes?
(rhetorical question)

Is this part of a foolish war about which books are best?

IMO: Goodman's is better laid out and has more detail. But having two
books is better than none. And while a pure reference (ECMA's or anyone
else's) is good, they tend to be rather skeletal.

That said, the property names are "selectionStart" and "selectionEnd",
respectively.  They are well-documented at MDC as they are native to XUL.

<https://developer.mozilla.org/en/XUL/Method/setSelectionRange>
<https://developer.mozilla.org/en/XUL/Property/selectionStart>
<https://developer.mozilla.org/en/XUL/Property/selectionEnd>

Yes, I found this. Flanagan makes one reference to XUL which eventually
leads to the URLs above. Useful as a reference but I could find little
discussion.

These seem to work in Safari 4 beta and FF3 (both Mac), but I'm
concerned they might be deprecated or not be best suited for my needs -
or that they might be part of a useful and well supported set that for
some reason I'm going to have to discover one item at a time.

They are certainly proprietary, but since they have been used, you don't
have to be afraid that they are going away anytime soon.  Just be aware of
it and do feature-test them before accessing them (you should do that anyway).

Well, faute de mieux I shall press on with these. Hopefully not as fast
as the Titanic, though.

Iceberg, right ahead (says "XUL" on it.) Use the objects I suggested.
.



Relevant Pages

  • Re: Cell references in Macros
    ... I want to expand the range, because I want to create a graph out of the data ... > Hi Jean-Paul, ... > Stop Macro recording on the right that toggles Relative Reference. ... >> Does any one have a tip how to bring the macro recorder to using relative ...
    (microsoft.public.excel)
  • Re: Clearing a Table (Access MDB file)
    ... The JetSQL reference is included in the Access online help. ... Scroll down until you see the Microsoft Jet SQL Reference and expand that ... This email account is my spam trap so I ...
    (microsoft.public.inetserver.asp.db)
  • Re: Dynamic Range for multiple columns
    ... Assume you currently have data in C2:D234 do you want your DynAbb to include ... that range and expand when you add more rows? ... With the formula above C12 to 10 blank cells below last used cell in column ... I then click on F5 and the cell number D35 is in the reference box. ...
    (microsoft.public.excel.misc)
  • Re: GpiCreateBitmap and RLE24
    ... > I seem to remember that there are data alignment issues. ... > I think that you have to either expand 24-bit value to a 32-bit value or ... asking about in another thread here, but for RLE24 this does not work. ... I can see a contradiction to the GPI reference. ...
    (comp.os.os2.programmer.misc)
  • Re: setSelectionRange and friends
    ... recognises that you seem to be typing in a nickname that it can expand, ... tell in for example Danny Goodman's or David Flanagan's JavaScript books. ... But those are XUL. ... modern browser ISTM that XUL objects are a ...
    (comp.lang.javascript)

Loading