Visit Mozilla.org

XUL:listitem

出典: MDC

« XUL リファレンス HOME    [ | 属性 | プロパティ | メソッド | 関連項目 ]

listbox の一つの行。listitem のテキストは listcell を使用するか、listitem 要素上に label 属性を直接置いて指定します。デフォルトでは、listitem の要素に適切な形式とクラスの一つの listcell 要素を含みます。

詳しい情報が XUL チュートリアルにあります。

属性
accesskey, checked, command, crop, current, disabled, image, label, preference, selected, tabindex, type, value
プロパティ
accessKey, accessible, checked, control, crop, current, disabled, image, label, selected, tabIndex, value
スタイルクラス
listitem-iconic

[編集]

Image:XUL_ref_listbox.png
 <listbox id="theList">
   <listitem label="Ruby"/>
   <listitem label="Emerald"/>
   <listitem label="Sapphire" selected="true"/>
   <listitem label="Diamond"/>
 </listbox>


[編集] 属性

XUL 要素からの継承
align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width

accesskey
型: character
ショートカットキーとして使用される文字を設定します。この文字はその要素の label 属性のテキストに現れる文字の一つでなければいけません。

checked
型: boolean
要素にチェックが入っているかどうかを示します。
この属性が設定されているかどうかを確認するには、getAttribute() ではなく hasAttribute() を使用してください。

command
型: 要素 id
要素に監視された command 要素の id をセットします。

crop
型: 下記の値のいずれか一つ
要素の label に与えられた空間が小さ過ぎるときは、crop 属性によって指定された側のテキストが切り取られます。テキストが切り取られた場所には省略記号 (ellipsis) が使用されます。ボックスの方向が反対の場合は、切り取られる場所も反対側になります。
  • start: テキストは先頭から切り取られます。
  • end: テキストは末尾から切り取られます。
  • left: 非推奨 テキストは左側から切り取られます。
  • right: 非推奨 テキストは右側から切り取られます。
  • center: テキストの中央が切り取られ、通常、テキストの先頭と末尾が表示されます。
  • none: テキストは省略記号を使用して切り取られません。しかし、テキストがあまりに長い場合は単純に削除されます。削除する側は CSS の行揃え (text alignment) に依存します。

current
型: boolean
この属性は、listitem が現在の項目のとき、true に設定されます。これは一般的に、フォーカス順をカスタマイズするため、テーマによって使用されます。listbox 内の現在選択された項目を変更するには listbox プロパティを使用してください。

disabled
型: 真偽値
要素が無効化されているかどうかを示します。ある要素が true に設定されていたら、その要素は無効化されています。無効化された要素は通常グレイ表示のテキストで描画されます。要素が無効化されていると、ユーザのアクションには応答せず、フォーカスもあてられず、command イベントも発生しません。

image
型: 画像の URL
要素上に表示する画像の URL。この属性が空または除外された場合、画像は表示されません。画像の位置は dir 属性および orient 属性によって決定されます。

label
型: string
要素上に表示するlabel。 省略された場合、テキストは表示されない。

preference
型: 要素の id
要素を対応する preference につなぎます。この属性は prefwindow 内で使用された場合のみ効果があります。preference の値は、要素の value プロパティと一致するように更新されます。

selected
型: 真偽値
要素が選択されているかを返します。この値は読み取り専用です。選択された項目を変更するには selectedIndexselectedItem プロパティの値を変更してください。

tabindex
型: 整数
要素のタブの順番。タブの順番は tab キーが押下されたときにフォーカスが移動する順番です。より大きな tabindex の値をもつ要素は、タブの遷移が後になります。

type
型: string
この属性の値を checkbox に設定することによって、listbox 内の項目をチェックボックスにすることができます。

value
型: 文字列
文字列の属性はデータ値を要素に関連付けます。特定の目的のために使われるわけではありませんが、スクリプトからあなた自身の用途のためにアクセスできます。

[編集] プロパティ

XUL 要素からの継承
align, allowEvents, boxObject, builder, className, collapsed, contextMenu, controllers, currentItem, database, datasources, dir, flex, height, hidden, id, left, listBoxObject, maxHeight, maxWidth, menu, minHeight, minWidth, observes, ordinal, orient, pack, persist, ref, resource, statusText, style, tooltip, tooltipText, top, value, width

DOM 要素からの継承
attributes, childNodes, cloneNode, firstChild, lastChild, localName, namespaceURI, nextSibling, nodeName, nodeType, nodeValue, ownerDocument, parentNode, prefix, previousSibling, tagName

accessKey
型: character
accesskey 属性の値の取得と設定。

accessible
型: nsIAccessible
要素の accessibility object を返す。

checked
型: boolean
checked 属性の値の取得と設定。

control
型: 要素の id
control 属性の値の取得と設定。

crop
型: string
crop 属性の値の取得と設定。

current
型: boolean
current 属性の値の取得と設定。

disabled
型: 真偽値
disabled 属性の値の取得と設定。

image
型: image URL
image 属性の値の取得と設定。

label
型: string
label 属性の値の取得と設定。

selected
型: 真偽値
このプロパティの値は、要素が選択されているときは true、選択されていないときは false です。このプロパティは読み取り専用です。

tabIndex
型: 整数
tabindex 属性の値の取得と設定。

value
型: 文字列
value 属性の値の取得と設定。

[編集] メソッド

XUL 要素からの継承
blur, click, doCommand, focus, getElementsByAttribute

DOM 要素からの継承
addEventListener, appendChild, dispatchEvent, getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getElementsByTagName, getElementsByTagNameNS, hasAttribute, hasAttributeNS, hasAttributes, hasChildNodes, insertBefore, isSupported, normalize, removeAttribute, removeAttributeNode, removeAttributeNS, removeChild, removeEventListener, replaceChild, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS

[編集] スタイルクラス

次のクラスは要素のスタイル付けに使用されます。これらのクラスは、ユーザの選択したテーマに自然に合うようにするため、要素のスタイルを直接変更する代わりに使用されます。

listitem-iconic
listitem 上に画像を表示するにはこのクラスを使用します。image 属性を使用して画像を指定してください。

[編集] 関連項目

要素
listbox, listcell, listcol, listcols, listhead, listheader
インタフェース
nsIAccessibleProvider, nsIDOMXULSelectControlItemElement