Neil Deakin <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> Antoine wrote:
> > I am trying to build an extension that I would install on Mozilla 1.6
> > and up.  In that extension, I need to retrieve the currently selected
> > text (for now, only in an editor such as the Compose Mail or the
> > Composer, will eventually need the same thing for a "text-viewer" like
> > the Navigator).
> > 
> > To get me started, I thought I would look at some of the code of the
> > Composer, since the spell checker kinda does what I need to do, which
> > is retrieve the selected text to do its work on it.  The spell checker
> > module does a couple of calls on a nsITextServicesDocument interface
> > to get what it needs about the text.  On that interface, the
> > GetCurrentTextBlock method seems to be what I need.  This method
> > requires a nsString as its parameter, in which it returns the string
> > I'm looking for.
> > 
> 
> If you're using an editor (nsIEditor), you can just call GetSelection to 
> get the selection. It will be an nsISelection. The text is available via 
> ToString() which has a return type of PRUnichar *;
> 
> / Neil

Thanks.  That did work for the part of the component that's dealing
with the editor.

However, I *would* eventually need the same selection to be returned
to me when using a non-editor (ie. navigator).  I've been looking all
day for this and still haven't figured it out.  Anyone has a pointer
on that?


Thanks again



Antoine
_______________________________________________
Mozilla-xpcom mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-xpcom

Reply via email to