nsIAutoCompleteController
From MDC
Add a description for this interface
Contents
|
nsIAutoCompleteController is defined in toolkit/components/autocomplete/public/nsIAutoCompleteController.idl. It is scriptable and
unfrozen (hasn't changed since 1.9).
Inherits from: nsISupports
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);
[edit] Method overview
void startSearch(in AString searchString);
|
void stopSearch();
|
void handleText(in boolean aIgnoreSelection);
|
boolean handleEnter();
|
boolean handleEscape();
|
void handleStartComposition();
|
void handleEndComposition();
|
void handleTab();
|
boolean handleKeyNavigation(in unsigned long key);
|
boolean handleDelete();
|
AString getValueAt(in long index);
|
AString getCommentAt(in long index);
|
AString getStyleAt(in long index);
|
AString getImageAt(in long index);
|
[edit] Attributes
| Attribute | Type | Description |
input
| nsIAutoCompleteInput
| The input widget that is currently being controlled. |
searchStatus
| unsigned short
| State which indicates the status of possible ongoing searches. |
matchCount
| unsigned long
| The number of matches. |
searchString
| AString
| Get or set the current search string. Note, setting this attribute will not initiate a search. |
[edit] 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. |
[edit] Methods
[edit] startSearch()
Start a search on a string, assuming the input property is already set.
void startSearch( in AString searchString );
[edit] Parameters
- searchString
- The string to start searching on.
[edit] stopSearch()
Stop all asynchronous searches.
void stopSearch();
[edit] Parameters
None.
[edit] handleText()
Notify 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 );
[edit] Parameters
- aIgnoreSelection
trueto allow the text handling to occur regardless of where the caret is in the text box;falseto only start the search to begin or resume if the caret is at the end of the text box.
[edit] handleEnter()
Notify the controller that the user wishes to enter the current text.
boolean handleEnter( in boolean aIsPopupSelection );
[edit] Parameters
- aIsPopupSelection
trueif a selection was made from the popup (i.e. the currently selected entry's value will entered into the input).falseto 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.
[edit] Return value
true if the controller wishes to prevent event propagation and default event.
[edit] handleEscape()
Notify the controller that the user wishes to revert autocomplete.
boolean handleEscape();
[edit] Parameters
None.
[edit] Return value
True if the controller wishes to prevent event propagation and default event.
[edit] handleStartComposition()
Notify the controller that the user wishes to start composition.
void handleStartComposition();
[edit] Parameters
None.
[edit] handleEndComposition()
Notify the controller that the user wishes to end composition.
void handleEndComposition();
[edit] Parameters
None.
[edit] handleTab()
Handle tab. Just closes up.
void handleTab();
[edit] Parameters
None.
[edit] handleKeyNavigation()
Notify the controller of the following key navigation events: up, down, left, right, page up, page down.
boolean handleKeyNavigation( in unsigned long key );
[edit] Parameters
- key
- The key for the navigation event.
[edit] Return value
True if the controller wishes to prevent event propagation and default event.
[edit] handleDelete()
Notify the controller that the user chose to delete the current auto-complete result.
boolean handleDelete();
[edit] Parameters
None.
[edit] Return value
Returns true if the event that called handleDelete() should be canceled, otherwise returns false.
[edit] getValueAt()
Get the value of the result at a given index in the last completed search.
AString getValueAt( in long index );
[edit] Parameters
- index
- The given index value.
[edit] Return value
The value of the result at the given index.
[edit] getCommentAt()
Get the comment of the result at a given index in the last completed search.
AString getCommentAt( in long index );
[edit] Parameters
- index
- The given index.
[edit] Return value
The comment of the result at the given index.
[edit] getStyleAt()
Get the style hint for the result at a given index in the last completed search.
AString getStyleAt( in long index );
[edit] Parameters
- index
- The given index.
[edit] Return value
The style hint for the result at the given index.
[edit] getImageAt()
Get the URL of the image of the result at a given index in the last completed search.
AString getImageAt( in long index );
[edit] Parameters
- index
- The given index.
[edit] Return value
The image URL of the result at the given index.