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
_______________________________________________ Mozilla-xpcom mailing list [EMAIL PROTECTED] http://mail.mozilla.org/listinfo/mozilla-xpcom
