nsISupports
Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)Implemented by: @mozilla.org/autocomplete/controller;1
. To use this service, use:
var autoCompleteController = Components.classes["@mozilla.org/autocomplete/controller;1"] .getService(Components.interfaces.nsIAutoCompleteController);
Method overview
AString getCommentAt(in long index); |
AString getImageAt(in long index); |
AString getLabelAt(in long index); |
AString getStyleAt(in long index); |
AString getValueAt(in long index); |
boolean handleDelete(); |
void handleEndComposition(); |
boolean handleEnter(in boolean aIsPopupSelection); |
boolean handleEscape(); |
boolean handleKeyNavigation(in unsigned long key); |
void handleStartComposition(); |
void handleTab(); |
void handleText(); |
void setSearchString(in AString aSearchString); Obsolete since Gecko 1.9 |
void startSearch(in AString searchString); |
void stopSearch(); |
Attributes
Attribute | Type | Description |
input |
|
Either the XUL autocomplete textbox that is currently being controlled, or a form fill controller that handles website form history. |
matchCount |
unsigned long |
The number of matches. Read only. |
searchStatus |
unsigned short |
State which indicates the status of possible ongoing searches. Read only. |
searchString |
AString |
Get or set the current search string. Note: Setting this attribute will not initiate a search. |
Constants
Status Constants
Constant | Value | Description |
STATUS_NONE |
1 |
Default status. |
STATUS_SEARCHING |
2 |
Searching for matches. |
STATUS_COMPLETE_NO_MATCH |
3 |
Search completed but found no matches. |
STATUS_COMPLETE_MATCH |
4 |
Search completed and found matches. |
Key Constants
Obsolete since Gecko 1.9 (Firefox 3)
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.
Constant | Value | Description |
KEY_UP |
1 |
|
KEY_DOWN |
2 |
|
KEY_LEFT |
3 |
|
KEY_RIGHT |
4 |
|
KEY_PAGE_UP |
5 |
|
KEY_PAGE_DOWN |
6 |
|
KEY_HOME |
7 |
|
KEY_END |
8 |
Methods
getCommentAt()
Gets the comment of the result at a given index in the last completed search.
AString getCommentAt( in long index );
Parameters
-
index
- The given index.
Return value
The comment of the result at the given index.
getImageAt()
Get the URL of the image of the result at a given index in the last completed search.
AString getImageAt( in long index );
Parameters
-
index
- The given index.
Return value
The image URL of the result at the given index.
getLabelAt()
Gets the label for the result at a given index in the last completed search. Normally this is the same as the value, except when autocompleting a datalist in a web page.
AString getLabelAt( in long index );
Parameters
-
index
- The given index.
Return value
The label for the result at the given index.
getStyleAt()
Get the style hint for the result at a given index in the last completed search.
AString getStyleAt( in long index );
Parameters
-
index
- The given index.
Return value
The style hint for the result at the given index.
getValueAt()
Gets the value of the result at a given index in the last completed search.
AString getValueAt( in long index );
Parameters
-
index
- The given index value.
Return value
The value of the result at the given index.
handleDelete()
Notifies the controller that the user chose to delete the current auto-complete result.
boolean handleDelete();
Parameters
None.
Return value
Returns true
if the event that called handleDelete()
should be canceled, otherwise returns false
.
handleEndComposition()
void handleEndComposition();
Parameters
None.
handleEnter()
Notifies the controller that the user wishes to enter the current text.
boolean handleEnter( in boolean aIsPopupSelection );
Parameters
-
aIsPopupSelection
-
true
if a selection was made from the popup (That is the currently selected entry's value will entered into the input).false
to indicate that the input's current value should be used. Typically used to differentiate between selections made with the mouse (which do not result in the input value being changed) and selections made with the keyboard (which may or may not result in the input's value changing, depending on the nsIAutocompleteInput's completeSelectedIndex attribute). See bug 408723 for more information.
Return value
true
if the controller wishes to prevent event propagation and default event.
handleEscape()
Notifies the controller that the user wishes to revert autocomplete.
boolean handleEscape();
Parameters
None.
Return value
true
if the controller wishes to prevent event propagation and default event.
handleKeyNavigation()
Notifies the controller of the following key navigation events: up, down, left, right, page up, page down.
boolean handleKeyNavigation( in unsigned long key );
Parameters
-
key
- The key for the navigation event.
Return value
true
if the controller wishes to prevent event propagation and default event.
handleStartComposition()
Notify the controller that the user wishes to start composition.
void handleStartComposition();
Parameters
None.
handleTab()
Handles tab; this just closes autocomplete.
void handleTab();
Parameters
None.
handleText()
Notifies the controller that the user has changed text in the textbox. This includes all means of changing the text value, including typing a character, backspacing, deleting, or pasting in an entirely new value.
void handleText(
in boolean aIgnoreSelection Obsolete since Gecko 1.9.2
);
Parameters
setSearchString()
Obsolete since Gecko 1.9 (Firefox 3)
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.
searchString
attribute in Gecko 1.9.void setSearchString( in AString aSearchString );
Parameters
-
aIgnoreSelection
Obsolete since Gecko 1.9.2 -
true
to allow the text handling to occur regardless of where the caret is in the text box;false
to only start the search to begin or resume if the caret is at the end of the text box.
-
aSearchString
- A string to use in searches.
startSearch()
Starts a search on a string, assuming the input property is already set.
void startSearch( in AString searchString );
Parameters
-
searchString
- The string to start searching on.
stopSearch()
Stops all asynchronous searches.
void stopSearch();
Parameters
None.