Textbox (Firefox 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.

Firefox uses a different autocomplete mechanism that the Mozilla suite. The example below will create an autocomplete textbox which will search the user's history.

Example:

    <textbox type="autocomplete" autocompletesearch="history"/>

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

nsIAccessibleProvider   nsIAutoCompleteInput   nsIDOMXULMenuListElement  

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

Firefox は Mozilla suite とは異なる自動補完メカニズムを用いる。下の例はユーザの履歴を検索する自動補完テキストボックスを作成する。

例:

    <textbox type="autocomplete" autocompletesearch="history"/>

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

nsIAccessibleProvider   nsIAutoCompleteInput   nsIDOMXULMenuListElement  

属性:

accesskey autocompletepopup autocompletesearch autocompletesearchparam completedefaultindex
crop disableautocomplete disabled disablekeynavigation enablehistory
focused forcecomplete ignoreblurwhilesearching inputtooltiptext label
maxlength maxrows minresultsforpopup nomatch onchange
oninput onsearchcomplete ontextentered ontextreverted open
readonly showcommentcolumn size tabindex tabscrolling
timeout type value

プロパティとメソッド:

accessible completeDefaultIndex controller crop disableAutoComplete
disableKeyNavigation disabled editable focused forceComplete
getSearchAt ignoreBlurWhileSearching inputField label maxLength
maxRows minResultsForPopup onSearchComplete onTextEntered onTextReverted
open popup popupOpen searchCount searchParam
select selectionEnd selectionStart setSelectionRange showCommentColumn
size tabScrolling textLength textValue timeout
type 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

accesskey

Type: character

This should be set to a letter that is used as a shortcut key. This letter should be one of the characters that appears in the label text for the textbox. This letter will typically be drawn underlined, although this behavior will be platform and theme specific. When the user presses ALT (or a similar key that varies on each platform) and the access key, the textbox will be activated from anywhere in the window. Although the value is case insensitive, a letter with the case matching the accesskey attribute will used if both cases exist in the label.

型: character

ショートカットキーとして使う文字に設定する。この文字は、テキストボックスのラベルテキストに現れる文字の一つである必要がある。この文字は一般に下線付きで表示される。一方、その振る舞いはプロットフォームやテーマに依存する。ユーザが ALT (またはプラットフォームによる同様のキー) とアクセスキーを押すと、ウィンドウのどこからでもテキストボックスは起動される。この値は文字の大小には関しないが、ラベルに両方がある場合には、 accesskey 属性にマッチする方の文字が使用される。

autocompletepopup

Type: id of popup element

The id of a popup element used to hold autocomplete results for the textbox.

型: id of popup element

テキストボックスの自動補完の結果を保持するのに使用されている popup 要素の id。

autocompletesearch

Type: space separated list of values

A space separated list of search component names, each of which implements the nsIAutoCompleteSearch interface. The components are created using the name '@mozilla.org/autocomplete/search;1?name=' where name is listed in this attribute.

  • history: Search the browser's URL history
  • form-history: Search the values that the user has entered into form fields.

型: space separated list of values

検索コンポーネント名を空白で区切ったリストで、そのコンポーネントはそれぞれ nsIAutoCompleteSearch インターフェイスを実装している。これらのコンポーネントは '@mozilla.org/autocomplete/search;1?name=<name>' という名前を使って作られ、この name はこの属性にリストアップされている。[訳注 : <name> に次の 2 つのどちらかを用いている。]

  • history: ブラウザの URL 履歴を検索する。
  • form-history: ユーザがフォームフィールドに入力した値を検索する。
autocompletesearchparam

Type: string

A string which is passed to the search component.

型: string

検索コンポーネントに渡す文字列。

completedefaultindex

Type: boolean

If true, the best match value will be filled into the textbox as the user types. If set to false or omitted, the value must be selected from the list.

型: boolean

true の場合、最もマッチした値がテキストボックスにユーザ入力として入れられる。 false にするか削除すると、その値はリストから選択しなければならない。

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

Set this attribute to true to disable autocomplete on the textbox. This might be used to temporarily disable autocomplete for a field.

型: boolean

この属性を true に設定すると、テキストボックスの自動補完を無効にできる。フィールドの自動補完を一時的に無効にするために用いる。

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 に設定したことに対応するものとして、この属性を取り除く。

disablekeynavigation

Type: boolean

If this attribute is not used, the user can navigate to specific items in the list by pressing the first the first letter of the item's label. This is done incrementally, so pressing additional keys will select more specific items. This feature may be disabled by setting this attribute to true.

型: boolean

この属性を使用しないときは、ユーザはリストの項目ラベルの最初の文字を押すことによって、特定の項目に移ることができる。インクリメンタルに行われるため、更にキーを押すことで、より特定した項目を選択することができる。この属性を true に設定することにより、この機能を無効にすることができる。

enablehistory

Type: boolean

If true, an arrow button will appear on the end of the textbox which, when pressed, will open a dropdown menu of all available results.

型: boolean

true のとき、矢印ボタンがテキストボックスの終端に表示される。このボタンを押すと、全ての利用可能な結果のドロップダウンメニューが開かれる。

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.

型: 文字列

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

maxlength

Type: integer

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

型: integer

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

maxrows

Type: integer

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.

型: integer

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

minresultsforpopup

Type: integer

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

型: integer

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

nomatch

Type: boolean

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

型: boolean

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

onchange

Type: script code

This event is sent when the value of the textbox is changed. The event is not sent until the focus is moved to another element.

型: script code

テキストボックスの値が変更されると、このイベントは送信される。別の要素にフォーカスが移動するまで、このイベントは送信されない。

oninput

Type: script code

This event is sent when a user enters text in a textbox. This event is only called when the text displayed would change, thus it is not called when the user presses non-displayable keys.

型: script code

ユーザがテキストボックスにテキストを入力すると、このイベントは送信される。このイベントは表示テキストが変化したときにのみ呼ばれるため、ユーザが非表示キーを押したときには呼ばれない。

onsearchcomplete

This event handler is called when the auto complete search is finished and results are available.

自動補完検索が終了し、その結果が利用可能になったとき、このイベントハンドラが呼ばれます。

ontextentered

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

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

ontextreverted

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

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

open

Type: boolean

This attribute will be set when the history popup is open. The open attribute is not present if the menu is closed.

型: boolean

履歴ポップアップが開いているとき、この属性が設定される。そのメニューが閉じているときは、 open 属性は存在しない。

readonly

Type: boolean

If set to true, then the user cannot modify the value of the textbox. However, the value may still be modified by a script.

型: boolean

true にした場合、ユーザはテキストボックスの値を変更することはできない。ただし、スクリプトから値を変更することはできる。

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 です。

size

Type: integer

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

型: integer

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

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 を持つ要素が、タブ順序のシーケンスで後になる。

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 キーを押すと次の要素へフォーカスが移る。

timeout

Type: integer

For timed textboxes, the number of milliseconds before the timer fires a command event. The timer starts after the user types a character. If the user types another character, the timer resets.

型: integer

タイマー付きテキストボックスにおける、タイマーが command イベントを送信するまでのミリ秒数。ユーザが文字を入力した後、タイマーが開始する。ユーザがまた別の文字入力を行った場合、タイマーはリセットされる。

type

Type: string

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

型: string

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

value

Type: string

A value associated with the textbox. You may use it in a script for your own purposes.

型: string

テキストボックスに関連づけられた値。独自の目的用にスクリプトで用いることができる。


プロパティとメソッド:

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 オブジェクトを返す。

completeDefaultIndex

Gets and sets the value of the completedefaultindex attribute.

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

controller

Type: nsIAutoCompleteController

Returns the controller for the auto complete element.

型: nsIAutoCompleteController

自動補完要素用のコントローラを返す。

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 属性の値を取得・設定する。

disableKeyNavigation

Gets and sets the value of the disablekeynavigation attribute.

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

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 属性の値を取得・設定する。

getSearchAt ( idx )

Return Type: string

Returns the search component with the given index. The components are set with the autocompletesearch attribute.

戻り値の型 : string

与えたインデックスを持つ検索コンポーネントを返す。このコンポーネントは、 autocompletesearch 属性を持つよう設定されている。

ignoreBlurWhileSearching

Gets and sets the value of the ignoreblurwhilesearching attribute.

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

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 要素の参照を保持する。

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 属性の値を取得・設定する。

onSearchComplete ( )

Return Type: no return value

Calls the searchcomplete event handler. You should not call this method yourself.

戻り値の型 : 戻り値なし

searchcomplete イベントハンドラを呼び出す。このメソッドは手動で呼び出すべきではない。

onTextEntered ( )

Return Type: event result

Calls the textentered event handler. You should not call this method yourself.

戻り値の型 : event result

textentered イベントハンドラを呼び出す。このメソッドは手動で呼び出すべきではない。

onTextReverted ( )

Return Type: event result

Calls the textreverted event handler. You should not call this method yourself.

戻り値の型 : event result

textreverted イベントハンドラを呼び出す。このメソッドは手動で呼び出すべきではない。

open

Gets and sets the value of the open attribute.

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

popup

Type: popup element id

Should be set to the value of the id of the popup element that should appear when the user clicks on the textbox.

型: popup element id

ユーザがテキストボックスをクリックしたときに表示される popup 要素の id の値を設定する必要がある。

popupOpen

Type: boolean

Indicates whether the popup is open or not. Set this property to open or close the popup.

型: boolean

ポップアップが開かれているかどうかを示す。ポップアップを開いたり閉じたりするには、このプロパティを設定する。

searchCount

Type: integer

Returns the number of search components used. This property is read only.

型: integer

使用している検索コンポーネントの数を返す。このプロパティは読み込み専用である。

searchParam

Type: string

Gets and sets the value of the autocompletesearchparam attribute.

型: string

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

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 プロパティとともに使用する。この値には最初の選択文字のインデックスを指定する。

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 属性の値を取得・設定する。

size

Type: integer

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

型: integer

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

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

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

textValue

Type: string

Returns the content of the textbox. Equivalent to the value property.

型: string

テキストボックスの内容を返す。 value プロパティと等価である。

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' を設定する。

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