nsIAutoCompleteInput 编辑

toolkit/components/autocomplete/public/nsIAutoCompleteInput.idlScriptable This interface monitors the input in a text field and displays an autocomplete panel at the appropriate time. Inherits from: nsISupports Last changed in Gecko 1.9 (Firefox 3)

Method overview

ACString getSearchAt(in unsigned long index);
void onSearchBegin();
void onSearchComplete();
boolean onTextEntered();
boolean onTextReverted();
void selectTextRange(in long startIndex, in long endIndex);

Attributes

AttributeTypeDescription
completeDefaultIndexbooleanIf a search result has its defaultIndex set, this will optionally try to complete the text in the textbox to the entire text of the result at the default index as the user types. This means that auto-fill is enabled.
completeSelectedIndexbooleanIf true, the text in the text field will be autocompleted as the user selects from the popup list.
consumeRollupEventbooleanIf true, the event that rolls up the popup should be consumed by the popup itself. If false, the rollup event will be dispatched. Read only.
controllernsIAutoCompleteControllerThe controller. Read only.
disableAutoCompletebooleantrue if auto-complete is currently disabled; otherwise false.
forceCompletebooleanIf true, the text field automatically completes to the default result whenever the user hits the enter key or the text field loses focus.
maxRowsunsigned longThe maximum number of rows to display in the autocomplete suggestion popup.
minResultsForPopupunsigned longSpecifies a minimum number of search results that must be available before the autocomplete popup will open.
popupnsIAutoCompletePopupThe view in which results will be displayed.Read only.
popupOpenbooleanIndicates whether or not the popup view is already open.
searchCountunsigned longThe number of autocomplete sessions to search. Read only.
searchParamAStringAn additional parameter used for configuring searches.
selectionEndlongThe ending index of the current selection in the text field. Read only.
selectionStartlongThe starting index of the current selection in the text field. Read only.
showCommentColumnbooleanIf true, a column is added to the popup, showing the comment for each autocomplete result.
showImageColumnbooleanIf true, a column is added to the popup, showing an additional image for each autocomplete result.
textValueAStringThe value of the text in the autocomplete text field.
timeoutunsigned longThe number of milliseconds after a keystroke before a search begins.

Methods

getSearchAt()

Returns the name of one of the autocomplete search session objects.

ACString getSearchAt(
  in unsigned long index
);
Parameters
index
The index number of the search session object whose name is to be returned.
Return value

The name of the specified object.

onSearchBegin()

Called when the search starts.

void onSearchBegin();
Parameters

None.

onSearchComplete()

Called when the search ends successfully.

void onSearchComplete();
Parameters

None.

onTextEntered()

Called when the user selects and presses enter on a result item.

boolean onTextEntered();
Parameters

None.

Return value

Return true to prevent handling the selection.

onTextReverted()

Called when the user cancels the autocomplete session.

boolean onTextReverted();
Parameters

None.

Return value

Return true to prevent the reversion.

selectTextRange()

Selects a range of text in the autocomplete text field.

void selectTextRange(
  in long startIndex,
  in long endIndex
);
Parameters
startIndex
The index to the first character in the text field to select.
endIndex
The index to the last character in the text field to select.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:93 次

字数:9005

最后编辑:7 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文