Textbox (Mozilla Auto Complete)

This element is created by setting the type attribute of a textbox to 'autocomplete'. It is used to create a textbox with a popup containing a list of possible completions for what the user has started to type.

The autocomplete functionality is handled through one of more session objects, each of which can return a set of results given the current value of the textbox. The sessions can be set using the searchSessions attribute or by calling the addSession method.

The textbox (Mozilla Auto Complete) element implements the following interfaces:

nsIAccessibleProvider   nsIDOMXULMenuListElement  

この要素は textbox 要素の type 属性に 'autocomplete' を指定することにより作られる。利用者が入力し始めた文を補完した候補リストを示す、ポップアップ付きのテキストボックスを作るために利用される。

自動補完機能は一つ以上のセッションオブジェクトで扱われ、その各々がテキストボックスの現在値で与えられる結果の集まりを返すことができる。セッションは searchSessions 属性を使って設定するか、または addSession メソッドを呼び出すことで設定することができる。

The textbox (Mozilla Auto Complete) 要素は以下のインターフェイスを実装している。

nsIAccessibleProvider   nsIDOMXULMenuListElement  

属性 :

alwaysopenpopup autoFill autoFillAfterMatch crop disableAutocomplete
disabled disablehistory focused forceComplete ignoreBlurWhileSearching
inputtooltiptext label maxlength maxrows minResultsForPopup
nomatch onerrorcommand ontextcommand ontextrevert open
searchSessions showCommentColumn showpopup size tabScrolling
tabindex timeout type userAction value

プロパティとメソッド :

accessible addSession alwaysOpenPopup autoFill autoFillAfterMatch
clearResults crop disableAutocomplete disabled editable
focused forceComplete getDefaultSession getResultAt getResultCount
getResultValueAt getSession getSessionByName getSessionResultAt getSessionStatusAt
getSessionValueAt ignoreBlurWhileSearching inputField isSearching isWaiting
label maxLength maxRows minResultsForPopup noMatch
open removeSession resultsPopup searchSessions select
selectionEnd selectionStart sessionCount setSelectionRange showCommentColumn
showPopup size syncSessions tabScrolling textLength
timeout type userAction value

属性 :

XUL Element から継承:

align
allowevents
allownegativeassertions
class
coalesceduplicatearcs
collapsed
container
containment
context
contextmenu
datasources
debug
dir
empty
equalsize
flags
flex
height
hidden
id
insertafter
insertbefore
left
maxheight
maxwidth
menu
minheight
minwidth
mousethrough
observes
ordinal
orient
pack
persist
popup
position
ref
removeelement
sortDirection
sortResource
sortResource2
statustext
style
template
tooltip
tooltiptext
top
uri
wait-cursor
width

alwaysopenpopup

Type: boolean

If true, the autocomplete popup will be displayed even when there are no matches. If false, the default value, the popup will be hidden.

型 : boolean

true の場合、マッチするものが無くても自動補完ポップアップは表示される。 false の場合 (デフォルト)、ポップアップは隠れる。

autoFill

Type: boolean

If set to true, the best match will be filled into the textbox as the user types. If false, the default, the value will not be filled in until the user selects an item.

型 : boolean

true に設定すると、最もマッチしたものが、ユーザ入力としてテキストボックスに入る。 false の場合 (デフォルト)、ユーザが項目を選択するまで値は入らない。

autoFillAfterMatch

Type: boolean

If set to true, the entire text of the best match will be displayed at the end of the input. If false, only the text that hasn't been entered yet will be filled in. The autoFill attribute must be set to true to use this feature.

型 : boolean

true に設定すると、最もマッチしたテキストの全体が入力の末尾に表示される。 false の場合、まだ入力されていないテキストのみが追加表示される。この機能を使用するには、 autoFill 属性を true に設定しておく必要がある。

crop

Type: one of the values below

If the label of the textbox is too small to fit in its given space, the text will be cropped on the side specified by the crop attribute. An ellipsis will be used in place of the cropped text. If the box direction is reversed, the cropping is reversed.

  • start: The text will be cropped on its left side.
  • end: The text will be cropped on its right side.
  • left: (Deprecated) The text will be cropped on its left side.
  • right: (Deprecated) The text will be cropped on its right side.
  • center: The text will be cropped on both sides.
  • none: The text will be not be cropped using an ellipsis. However, the text will simply be cut off if it is too large. The side depends on the CSS text alignment.

型 : 以下の値の一つ

与えられたスペースが小さくてテキストボックスのラベルがその場所に合わないとき、crop 属性で指定した側にテキストは切り取られる。切り取られたテキストの位置には、省略記号が用いられる。ボックスの方向が逆のときは、切り取りも逆になる。

  • start: テキストの左側が切り取られる。
  • end: テキストの右側が切り取られる。
  • left: (非推奨) テキストの左側が切り取られる。
  • right: (非推奨) テキストの右側が切り取られる。
  • center: テキストの両側が切り取られる。
  • none: テキストの切り取りに省略記号が用いられない。テキストが非常に大きいときには、単に切られるだけである。側は CSS のテキスト配置 (alignment) に依存する。
disableAutocomplete

Type: boolean

If true, the autocomplete behavior will be disabled. You might use a script to change this attribute. If false, the default, autocomplete is enabled.

型 : boolean

true の場合、自動補完の振るまいは無効になる。スクリプトを使って、この属性を変更することができる。 false の場合 (デフォルト)、自動補完は有効である。

disabled

Type: boolean

Indicates whether the textbox is disabled or not. If this attribute is set to true, the textbox is disabled. This is usually drawn with the text in grey. If the textbox is disabled, it does not respond to user actions. The element cannot be focused and the command event will not fire. The element will still respond to mouse events. To enable the textbox, leave the attribute out entirely as opposed to setting the value to false.

型 : boolean

テキストボックスが無効か有効かを表す。この属性を true に設定すると、テキストボックスは無効になる。通常、テキストが灰色で表示される。テキストボックスが無効の場合には、ユーザアクションに応答しない。要素にフォーカスできず、またコマンドイベントは起きない。マウスイベントにはまだ応答する。テキストボックスを有効にするには、値を false に設定したことに対応するものとして、この属性を取り除く。

disablehistory

If false, an arrow button will appear on the end of the textbox which, when pressed, will open a dropdown menu of the history items. The default value is true, which will hide the dropdown button.

false のとき、矢印ボタンがテキストボックスの終端に表示される。このボタンを押すと、全ての利用可能な結果のドロップダウンメニューが開かれる。デフォルト値は true であり、ドロップダウンボタンは隠されている。[訳注 : Firefox の場合は enablehistory であることに注意.]

focused

Type: boolean

This attribute is set to true if the textbox element is focused.

型 : boolean

textbox 要素がフォーカスされているときは、この属性は true に設定される。

forceComplete

Type: boolean

If true, the textbox will be filled in with the best match when it loses the focus. If false, it will only be filled in when the user selects an item.

型 : boolean

true のとき、テキストボックスはフォーカスを失ったときに最もマッチしていたもので埋められる。 false のときは、ユーザが項目を選択したときにのみテキストボックスは埋められる。

ignoreBlurWhileSearching

Type: boolean

If true, blur events are ignored while searching, which means that the autocomplete popup will not disappear.

型 : boolean

true のとき、検索の間ブラーイベントは無視される。これは自動補完のポップアップが消えない、ということである。

inputtooltiptext

Type: string

The tooltip text for the textbox.

型 : string

テキストボックスのツールチップのテキスト。

label

Type: string

The label that will appear on the textbox. If this is left out, no text appears.

型 : string

テキストボックスに表示するラベル。この属性がないときには、テキストは表示されない。

maxlength

Type: integer

The maximum number of characters that the textbox allows to be entered.

型 : integer

テキストボックスに入力が許されている最大文字数。

maxrows

The number of rows to show in the results list at a time. A scrollbar will appear so the user can scroll through the remaining items.

結果のリストに一度に表示される行数。スクロールバーが表れるため、残りの項目をスクロールすることができる。

minResultsForPopup

Type: integer

The minimum number of results that must be returned for the popup to be displayed.

型 : integer

ポップアップでの表示用に返す必要のある結果の数の最小数。

nomatch

This attribute will be set to true if the last search resulted in no matches.

最後の検索にマッチするものがなければ、この属性は true に設定される。

onerrorcommand

This event handler is called when an error occurs when selecting a result from the popup.

ポップアップから結果を選択したときにエラーが発生すると、このイベントハンドラが呼ばれます。

ontextcommand

This event handler is called when a result is selected for the textbox.

テキストボックス用に結果が選択されたとき、このイベントハンドラが呼ばれます。

ontextrevert

This event handler is called when the user presses Escape to revert the textbox to its original uncompleted value.

テキストボックスの値を元の補完前の値に戻すためにユーザが Escape を押したとき、このイベントハンドラが呼ばれます。

open

Type: boolean

If true, the popup is showing. You can change this value to show or hide the popup.

型 : boolean

true のとき、ポップアップは表示されています。この属性を変更することで、ポップアップを表示したり隠したりできます。

searchSessions

Type: space separated list of session names

Set to a keyword indicating what type of data to look up for autocomplete. You may set multiple types by separating their names by spaces. The following values are possible, although custom components may be installed which add others.

  • history: The user's URL history is searched.
  • addrbook: The user's address book is searched.
  • ldap: The user's LDAP directories are searched.

型 : space separated list of session names

自動補完用に何のデータ型を見るかを指定する、キーワードを設定する。スペースで名前を区切って、複数の型を設定することができる。以下の値が可能であるが、カスタムコンポーネントをインストールして他の値を追加することもできる。

  • history: ユーザの URL 履歴が検索される。
  • addrbook: ユーザのアドレスブックが検索される。
  • ldap: ユーザの LDAP ディレクトリが検索される。
showCommentColumn

Type: boolean

If true, a comment column appears in the popup. For the URL history, the comment column will contain the page titles associated with each URL. The default value of this property is false.

型 : boolean

true の場合、ポップアップにコメント列が表示される。 URL 履歴では、コメント列は各 URL に関するページタイトルを含む。このプロパティのデフォルト値は false です。

showpopup

Type: boolean

If true, the popup will be shown. If false, the popup will not be shown, but the autocomplete results will still be available. You can set this to false and set the autoFill attribute to true to emulate a Communicator 4.x style autocomplete textbox. The default value is true.

型 : boolean

true のとき、ポップアップは表示される。 false のとき、ポップアップは表示されないが、自動補完の結果はまだ利用できる。この属性に false を設定し、 autoFill 属性に true を設定すると、 Communicator 4.x スタイルの自動補完テキストボックスをエミュレートすることができる。デフォルト値は true である。

size

Type: integer

The number of characters that can be displayed in the textbox.

型 : integer

テキストボックスに表示可能な文字数。

tabScrolling

Type: boolean

If true, the user may cycle through the results list by pressing the TAB key. If false, the default, the TAB key moves the focus to the next element.

型 : boolean

true の場合、ユーザは TAB キーを押せば結果のリストをサイクルすることができる。 false の場合 (デフォルト) 、 TAB キーを押すと次の要素へフォーカスが移る。

tabindex

Type: integer

The tab order of the element. The tab order is the order in which the focus is moved when the user presses the Tab key. Elements with a higher tabindex are later in the tab order sequence.

型 : integer

要素のタブ順序。タブ順序とは、ユーザが Tab キーを押したときにフォーカスが移動する順番のこと。高い tabindex を持つ要素が、タブ順序のシーケンスで後になる。

timeout

Set to the number of milliseconds to wait between when the users presses a key and the results list updates. The default value is 50, which is very fast.

ユーザがキーを押したときと結果のリストが更新される間の、待ちのミリ秒数を設定する。デフォルト値は 50 であり、非常に速い。

type

Type: string

Set to the value 'autocomplete' to have an autocomplete textbox.

型 : string

自動補完テキストボックスにするには、値 'autocomplete' を設定する。

userAction

This attribute will be set to the action the user is currently performing. Possible values:

  • none: The user is not interacting with the textbox.
  • typing: The user is typing into the textbox.
  • scrolling: The user is scrolling through the textbox.

この属性は、ユーザが現在行っているアクションに設定される。取りうる値は以下のものである。

  • none: ユーザはテキストボックスに何もしていない。
  • typing: ユーザはテキストボックスに入力している。
  • scrolling: ユーザはテキストボックスをスクロールしている。
value

Type: string

The default value entered in the textbox. The attribute only holds the default value and is never modified when the user enters text. To get the updated value, use the value property.

型 : string

テキストボックスへの入力のデフォルト値。この属性はデフォルト値を保持するだけであり、ユーザがテキストを入力したときでも変更されることはありません。更新された値を取得するには、 value プロパティを用いる。


プロパティとメソッド :

XUL Element から継承:

align
allowEvents
blur
boxObject
boxObject.element
boxObject.getLookAndFeelMetric
boxObject.height
boxObject.screenX
boxObject.screenY
boxObject.width
boxObject.x
boxObject.y
builder
className
click
collapsed
contextMenu
controllers
database
datasources
dir
doCommand
flex
focus
getElementsByAttribute
height
hidden
id
left
maxHeight
maxWidth
menu
minHeight
minWidth
observes
ordinal
orient
pack
persist
ref
resource
statusText
style
tooltip
tooltipText
top
width

Element から継承:

addEventListener
appendChild
attributes
childNodes
cloneNode
dispatchEvent
firstChild
getAttribute
getAttributeNS
getAttributeNode
getAttributeNodeNS
getElementsByTagName
getElementsByTagNameNS
hasAttribute
hasAttributeNS
hasAttributes
hasChildNodes
insertBefore
isSupported
lastChild
localName
namespaceURI
nextSibling
nodeName
nodeType
nodeValue
normalize
ownerDocument
parentNode
prefix
previousSibling
removeAttribute
removeAttributeNS
removeAttributeNode
removeChild
removeEventListener
replaceChild
setAttribute
setAttributeNS
setAttributeNode
setAttributeNodeNS
tagName

accessible

Type: nsIAccessible

Returns the accessibility object for the textbox.

型 : nsIAccessible

テキストボックスの accessibility オブジェクトを返す。

addSession ( session )

Adds a new session object to the autocomplete widget. This can be used to create a customized autocomplete results list. The argument should be an object which implements the nsIAutoCompleteSession interface.

自動補完ウィジェットに新しいセッションオブジェクトを追加する。カスタマイズされた自動補完の結果のリストを作成するのに用いられる。引数は nsIAutoCompleteSession インターフェイスを実装したオブジェクトである必要がある。

alwaysOpenPopup

Gets and sets the value of the alwaysopenpopup attribute.

alwaysopenpopup 属性の値を取得・設定する。

autoFill

Gets and sets the value of the autoFill attribute.

autoFill 属性の値を取得・設定する。

autoFillAfterMatch

Gets and sets the value of the autoFillAfterMatch attribute.

autoFillAfterMatch 属性の値を取得・設定する。

clearResults ( )

Clears the results list.

結果のリストをクリアする。

crop

Type: string

Gets and sets the value of the crop attribute.

型 : string

crop 属性の値を取得・設定する。

disableAutocomplete

Gets and sets the value of the disableAutocomplete attribute.

disableAutocomplete 属性の値を取得・設定する。

disabled

Type: boolean

Gets and sets the value of the disabled attribute.

型 : boolean

disabled 属性の値を取得・設定する。

editable

Type: boolean

Autocomplete fields are editable so this property always returns true.

型 : boolean

自動補完フィールドは編集可能であるため、このプロパティは常に true を返す。

focused

Type: boolean

Gets and sets the value of the focused attribute.

型 : boolean

focused 属性の値を取得・設定する。

forceComplete

Gets and sets the value of the forceComplete attribute.

forceComplete 属性の値を取得・設定する。

getDefaultSession ( )

Returns the name of the first session with available results.

利用可能な結果を持つ最初のセッションの名前を返す。

getResultAt ( index )

Returns the result item at the specified index. The item will be a value of type nsIAutoCompleteItem.

指定したインデックスの結果の項目を返す。この項目は、 nsIAutoCompleteItem 型の値である。

getResultCount ( session )

Returns the number of results. (The session argument is currently ignored).

結果の数を返す。 (引数 session は現在無視される。)

getResultValueAt ( index )

Returns the result value at the specified index. The item will correspond to the text of that item that appears in the popup.

指定したインデックスの結果の値を返す。この項目は、ポップアップに表示される項目のテキストに対応する。

getSession ( index )

Returns the session object with the given index. This will return an object of type nsIAutoCompleteSession.

指定したインデックスのセッションオブジェクトを返す。これは nsIAutoCompleteSession 型のオブジェクトを返す。

getSessionByName ( name )

Returns the session object with the given name. This will return an object of type nsIAutoCompleteSession.

指定した名前のセッションオブジェクトを返す。これは、 nsIAutoCompleteSession 型のオブジェクトを返す。

getSessionResultAt ( session , index )

Returns the result item at the specified index for a specific session.

特定のセッションで指定したインデックスの結果の項目を返す。

getSessionStatusAt ( index )

Returns the status for the session object with the given index.

指定したインデックスのセッションオブジェクトのステータスを返す。

getSessionValueAt ( session , index )

Returns the result value at the specified index for a specific session.

特定のセッションで指定したインデックスの結果の値を返す。

ignoreBlurWhileSearching

Type: boolean

If true, blur events are ignored while searching, which means that the autocomplete popup will not disappear.

型 : boolean

true のとき、検索の間ブラーイベントは無視される。これは自動補完のポップアップが消えない、ということである。

inputField

Type: textbox element

In Mozilla, the XUL textbox is implemented as a wrapper around an HTML input element. This read only property holds a reference to this inner input element.

型 : textbox element

Mozilla では、 XUL の textbox は HTML の input 要素のラッパーとして実装されている。この読み込み専用プロパティは、内部の input 要素の参照を保持する。

isSearching

This property is set to true while a search is occuring.

検索中、このプロパティは true に設定される。

isWaiting

This property is set to true during the period while waiting for the timeout between the time when a user has pressed a key and a search is performed.

ユーザがキーを押してから検索が始まるまでの timeout を待つ間、このプロパティは true に設定される。

label

Type: string

Gets and sets the value of the label attribute.

型 : string

label 属性の値を取得・設定する。

maxLength

Type: integer

The maximum number of characters that the textbox allows to be entered.

型 : integer

テキストボックスに入力が許されている最大文字数。

maxRows

Gets and sets the value of the maxrows attribute.

maxrows 属性の値を取得・設定する。

minResultsForPopup

Gets and sets the value of the minResultsForPopup attribute.

minResultsForPopup 属性の値を取得・設定する。

noMatch

This property will be set to true if the last search resulted in no matches.

最新の検索結果にマッチするものがなかったなら、このプロパティは true に設定される。

open

Gets and sets the value of the open attribute.

open 属性の値を取得・設定する。

removeSession ( session )

Removes a session object from the autocomplete widget. The argument should be an object which implements the nsIAutoCompleteSession interface.

自動補完ウィジェットからセッションオブジェクトを削除する。この引数は、 nsIAutoCompleteSession インターフェイスを実装したオブジェクトでなければならない。

resultsPopup

This property is set to the popup element that displays the results.

このプロパティは、結果を表示する popup 要素に設定される。

searchSessions

Type: space separated list of session names

Set to a keyword indicating what type of data to look up for autocomplete. You may set multiple types by separating their names by spaces. The following values are possible, although custom components may be installed which add others.

  • history: The user's URL history is searched.
  • addrbook: The user's address book is searched.
  • ldap: The user's LDAP directories are searched.

型 : space separated list of session names

自動補完用に何のデータ型を見るかを指定する、キーワードを設定する。スペースで名前を区切って、複数の型を設定することができる。以下の値が可能であるが、カスタムコンポーネントをインストールして他の値を追加することもできる。

  • history: ユーザの URL 履歴が検索される。
  • addrbook: ユーザのアドレスブックが検索される。
  • ldap: ユーザの LDAP ディレクトリが検索される。
select ( )

Return Type: no return value

Select all the text in the textbox.

戻り値の型 : 戻り値なし

テキストボックスの全テキストを選択する。

selectionEnd

Type: integer

Get or modify the end of the selected portion of the field's text. Use in conjuction with the selectionEnd property. The value specifies the index of the character after the selection. If this value is equal to the selectionStart property, no text is selected, but the value indicates the position of the caret (cursor) within the textbox.

型 : integer

フィールドテキストの選択部分の終りを取得または変更する。selectionStart プロパティとともに使用する [訳注 : 原文では selectionEnd となっているが、selectionStart の間違いと思われる。conjuction も conjunction の間違いであろう。]。この値には選択部分の次の文字のインデックスを指定する。この値が selectionStart プロパティに等しい場合、テキストの選択はない。ただし、その値はテキストボックスのキャレット (カーソル) 位置を示す。

selectionStart

Type: integer

Get or modify the beginning of the selected portion of the field's text. Use in conjuction with the selectionEnd property. The value specifies the index of the first selected character.

型 : integer

フィールドテキストの選択部分の始まりを取得または変更する。selectionEnd プロパティとともに使用する。この値には最初の選択文字のインデックスを指定する。

sessionCount

Holds the number of sessions.

セッション数を保持する。

setSelectionRange ( start , end )

Return Type: no return value

Sets the selected portion of the textbox, where the start argument is the index of the first character to select and the end argument is the index of the character after the selection. Set both arguments to the same value to move the cursor to the corresponding position without selecting text.

戻り値の型 : 戻り値なし

テキストボックスの選択部分を設定する。ここで、引数 start は設定する最初の文字のインデックスであり、引数 end は選択部分の次の文字のインデックスである。両引数とも同じ値に設定すると、選択テキストはなしで、対応する位置にカーソルを移動させる。

showCommentColumn

Gets and sets the value of the showCommentColumn attribute.

showCommentColumn 属性の値を取得・設定する。

showPopup

Gets and sets the value of the showpopup attribute.

showpopup 属性の値を取得・設定する。

size

Type: integer

The number of characters that can be displayed in the textbox.

型 : integer

テキストボックスに表示可能な文字数。

syncSessions ( autoCompleteElement )

Copy the sessions from another autocomplete element.

もう一つの自動補完要素からセッションをコピーする。

tabScrolling

Gets and sets the value of the tabScrolling attribute.

tabScrolling 属性の値を取得・設定する。

textLength

Type: integer

Holds the length of the text entered in the textbox. This property is read only.

型 : integer

テキストボックスに入力されたテキストの長さを保持する。このプロパティは読み込み専用である。

timeout

Type: integer

Gets and sets the value of the timeout attribute.

型 : integer

timeout 属性の値を取得・設定する。

type

Type: string

Set to the value 'autocomplete' to have an autocomplete textbox.

型 : string

自動補完テキストボックスにするには、値 'autocomplete' を設定する。

userAction

Gets and sets the value of the userAction attribute.

userAction 属性の値を取得・設定する。

value

Type: string

Returns the text entered into the textbox. You can set this property to change the text in the textbox.

型 : string

テキストボックスに入力されたテキストを返す。このプロパティを設定すると、テキストボックスのテキストを変更することができる。


Copyright (C) 1999 - 2004 XulPlanet.com