Menupopup

A container used to display menus. It should be placed inside a menu, menulist or menu-type button element. It can contain any element but usually will contain menuitem elements. It is a type of box that defaults to vertical orientation.

More information about menupopup

メニューを表示するために利用されるコンテナ要素。 menu 要素, menulist 要素, メニュー型 button 要素いずれかの中に置く必要がある。任意の要素を持つことができるが、通常はいくつかの menuitem 要素を持つ。これは縦並びを既定方向とする box の一種である。

menupopup の追加情報

属性:

ignorekeys left onpopuphidden onpopuphiding onpopupshowing
onpopupshown position top

プロパティとメソッド:

accessible hidePopup moveTo popupBoxObject position
showPopup sizeTo

属性:

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

ignorekeys

Type: boolean

If true, keyboard navigation between menu items in the popup is disabled.

型 : boolean

true のとき、ポップアップのメニュー項目間をキーボードで移動することができません。

left

Type: integer

Overrides the horizontal position of the popup specified by the showPopup function.

型 : integer

showPopup 関数で指定したポップアップの水平方向位置を上書きする。

onpopuphidden

Type: script code

This event is sent to a popup after it has been hidden.

型 : script code

ポップアップが隠された後、そのポップアップにこのイベントが送信される。

onpopuphiding

Type: script code

This event is sent to a popup when it is about to be hidden.

型 : script code

ポップアップが隠されている最中に、そのポップアップにこのイベントが送信される。

onpopupshowing

Type: script code

This event is sent to a menupopup just before it is popped open. This handler is usually used to dynamically set the commands on a menu when the user requests to display it. Returning false from this event handler prevents the popup from appearing.

型 : script code

menupopup が開かれる直前に、このイベントは menupopup に送信される。このハンドラは通常、ユーザが menupopup を表示するよう要求したときにメニューのコマンドを動的に設定するために使用される。このイベントハンドラが false を返すと、ポップアップの表示が取りやめられる。

onpopupshown

Type: script code

This is event is sent to a popup after it has been opened, much like the onload event is sent to a window when it is opened.

型 : script code

ウィンドウが開かれたときに onload イベントがそのウィンドウに送信されるのと同様に、このイベントはポップアップが開かれた後、そのポップアップに送信される。

position

Type: one of the values below

The position attribute determines where the popup appears relative to the element the user clicked to invoke the popup. This allows you to place the menu on one side on a button.

  • after_start: The popup appears underneath the element with the popup's upper-left corner aligned with the lower-left corner of the element. The left edges of the element and the popup are aligned. This is typically used for drop-down menus.
  • after_end: The popup appears underneath the element with the popup's upper-right corner aligned with the lower-right corner of the element. The right edges of the element and the popup are aligned.
  • before_start: The popup appears above the element with the popup's lower-left corner aligned with the upper-left corner of the element. The left edges of the element and the popup are aligned.
  • before_end: The popup appears above the element with the popup's lower-right corner aligned with the upper-right corner of the element. The right edges of the element and the popup are aligned.
  • end_after: The popup appears to the right of the element with the popup's lower-left corner aligned with the lower-right corner of the element. The bottom edges of the element and the popup are aligned.
  • end_before: The popup appears to the right of the element with the popup's upper-left corner aligned with the upper-right corner of the element. The top edges of the element and the popup are aligned.
  • start_after: The popup appears to the left of the element with the popup's lower-right corner aligned with the lower-left corner of the element. The bottom edges of the element and the popup are aligned.
  • start_before: The popup appears to the left of the element with the popup's upper-right corner aligned with the upper-left corner of the element. The top edges of the element and the popup are aligned.
  • overlap: The popup appears over top of the element with the upper-left corners aligned.
  • at_pointer: The popup appears at the same position as the mouse pointer.
  • after_pointer: The popup appears at the same horizontal position as the mouse pointer, but vertically, it is placed just below the element.

型 : 以下の値の一つ

position 属性は、ポップアップを起動するためにユーザがクリックした要素と相対した、ポップアップが表示される位置を決定する。これにより、ボタンのどの側にメニューを表示させるかを指定することができる。

  • after_start: 要素の左下端にポップアップの左上端が合うように、ポップアップは要素の下に表示される。要素の左端とポップアップの左端は一直線になる。これは一般的には、ドロップダウンメニューに使用される。
  • after_end: 要素の右下端にポップアップの右上端が合うように、ポップアップは要素の下に表示される。要素の右端とポップアップの右端は一直線になる。
  • before_start: 要素の左上端にポップアップの左下端が合うように、ポップアップは要素の上に表示される。要素の左端とポップアップの左端は一直線になる。
  • before_end: 要素の右上端にポップアップの右下端が合うように、ポップアップは要素の上に表示される。要素の右端とポップアップの右端は一直線になる。
  • end_after: 要素の右下端にポップアップの左下端が合うように、ポップアップは要素の右側に表示される。要素の下端とポップアップの下端は一直線になる。
  • end_before: 要素の右上端にポップアップの左上端が合うように、ポップアップは要素の右側に表示される。要素の上端とポップアップの上端は一直線になる。
  • start_after: 要素の左下端にポップアップの右下端が合うように、ポップアップは要素の左側に表示される。要素の下端とポップアップの下端は一直線になる。
  • start_before: 要素の左上端にポップアップの右上端が合うように、ポップアップは要素の左側に表示される。要素の上端とポップアップの上端は一直線になる。
  • overlap: ポップアップは要素の前面に、左上端が整列するように表示される。
  • at_pointer: ポップアップはマウスポインタと同じ位置に表示される。
  • after_pointer: ポップアップは、水平位置はマウスポインタと同じ位置に表示されるが、垂直位置は要素の直下に表示される。
top

Type: integer

Overrides the vertical position of the popup specified by the showPopup function.

型 : integer

showPopup 関数で指定したポップアップの垂直方向位置を上書きする。


プロパティとメソッド:

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 menupopup.

型 : nsIAccessible

menupopup の accessibility オブジェクトを返す。

hidePopup ( )

Return Type: no return value

Closes the popup menu immediately.

戻り値の型 : 戻り値なし

ポップアップメニューをすぐに閉じる。

moveTo ( x , y )

Return Type: no return value

Moves the popup to a new location.

戻り値の型 : 戻り値なし

ポップアップを新しい位置に移動する。

popupBoxObject

Type: nsIPopupBoxObject

This read-only property holds the nsIPopupBoxObject that implements the menupopup. You wouldn't normally need to use this property as all of its functions are available via the menupopup itself.

型 : nsIPopupBoxObject

この読み込み専用プロパティは、menupopup を実装している nsIPopupBoxObject を持つ。その関数は全て menupopup 自身から利用できるため、通常はこのプロパティを使用する必要はない。

position

Type: one of the values below

The position attribute determines where the popup appears relative to the element the user clicked to invoke the popup. This allows you to place the menu on one side on a button.

  • after_start: The popup appears underneath the element with the popup's upper-left corner aligned with the lower-left corner of the element. The left edges of the element and the popup are aligned. This is typically used for drop-down menus.
  • after_end: The popup appears underneath the element with the popup's upper-right corner aligned with the lower-right corner of the element. The right edges of the element and the popup are aligned.
  • before_start: The popup appears above the element with the popup's lower-left corner aligned with the upper-left corner of the element. The left edges of the element and the popup are aligned.
  • before_end: The popup appears above the element with the popup's lower-right corner aligned with the upper-right corner of the element. The right edges of the element and the popup are aligned.
  • end_after: The popup appears to the right of the element with the popup's lower-left corner aligned with the lower-right corner of the element. The bottom edges of the element and the popup are aligned.
  • end_before: The popup appears to the right of the element with the popup's upper-left corner aligned with the upper-right corner of the element. The top edges of the element and the popup are aligned.
  • start_after: The popup appears to the left of the element with the popup's lower-right corner aligned with the lower-left corner of the element. The bottom edges of the element and the popup are aligned.
  • start_before: The popup appears to the left of the element with the popup's upper-right corner aligned with the upper-left corner of the element. The top edges of the element and the popup are aligned.
  • overlap: The popup appears over top of the element with the upper-left corners aligned.
  • at_pointer: The popup appears at the same position as the mouse pointer.
  • after_pointer: The popup appears at the same horizontal position as the mouse pointer, but vertically, it is placed just below the element.

型 : 以下の値の一つ

position 属性は、ポップアップを起動するためにユーザがクリックした要素と相対した、ポップアップが表示される位置を決定する。これにより、ボタンのどの側にメニューを表示させるかを指定することができる。

  • after_start: 要素の左下端にポップアップの左上端が合うように、ポップアップは要素の下に表示される。要素の左端とポップアップの左端は一直線になる。これは一般的には、ドロップダウンメニューに使用される。
  • after_end: 要素の右下端にポップアップの右上端が合うように、ポップアップは要素の下に表示される。要素の右端とポップアップの右端は一直線になる。
  • before_start: 要素の左上端にポップアップの左下端が合うように、ポップアップは要素の上に表示される。要素の左端とポップアップの左端は一直線になる。
  • before_end: 要素の右上端にポップアップの右下端が合うように、ポップアップは要素の上に表示される。要素の右端とポップアップの右端は一直線になる。
  • end_after: 要素の右下端にポップアップの左下端が合うように、ポップアップは要素の右側に表示される。要素の下端とポップアップの下端は一直線になる。
  • end_before: 要素の右上端にポップアップの左上端が合うように、ポップアップは要素の右側に表示される。要素の上端とポップアップの上端は一直線になる。
  • start_after: 要素の左下端にポップアップの右下端が合うように、ポップアップは要素の左側に表示される。要素の下端とポップアップの下端は一直線になる。
  • start_before: 要素の左上端にポップアップの右上端が合うように、ポップアップは要素の左側に表示される。要素の上端とポップアップの上端は一直線になる。
  • overlap: ポップアップは要素の前面に、左上端が整列するように表示される。
  • at_pointer: ポップアップはマウスポインタと同じ位置に表示される。
  • after_pointer: ポップアップは、水平位置はマウスポインタと同じ位置に表示されるが、垂直位置は要素の直下に表示される。
showPopup ( element, x , y , popupType, anchor, align )

Return Type: no return value

Opens a popup window. There are two ways of specifying where the popup appears, either at a specific screen position, or relative to some element in the window. If either x and y are set to values, the popup will appear at the screen coordinate (x,y). If x and y are -1, the popup will be positioned relative to the element specified as the first argument. This is what you might do to show a popup underneath a button for example. In this latter case, the anchor and align arguments may be used to further control where the popup appears relative to the element. The anchor argument corresponds to the popupanchor attribute on the element. The align argument corresponds to the popupalign attribute on the element. The anchor and align attributes are ignored if either x or y are not -1.

To have a popup appear relative to another element yet still be offset by some number of pixels, determine the actual screen position of the element using the boxObject.screenX and boxObject.screenY properties of the element and use those as the x and y arguments offset by the desired values.

Type should be either the string "popup", "context" or "tooltip". Each type of popup is intended to be displayed only temporarily; they are not excepted to be displayed permanently. Only one popup may be displayed at a time. This example will open the popup anchored on the bottom-left corner of the button someButton:

  menupopup.showPopup (someButton,-1,-1,"popup","bottomleft","topleft");  

戻り値の型 : 戻り値なし

ポップアップウィンドウを開く。ポップアップをどこに表示するかを指定するには、2 通りの方法がある。特定のスクリーン位置か、またはウィンドウのある要素に相対した位置か、である。x と y がともに値を設定されたときは、ポップアップはスクリーン座標 (x,y) に表示される。 x と y がともに -1 のときは、ポップアップは最初の引数で指定した要素に相対した位置になる。これは例えば、ボタンの下にポップアップを表示するときに行うことである。この後者の場合では anchor と align 引数で、ポップアップを要素に相対してどの位置に表示するかをさらにコントロールするのに使用できる。 anchor 引数は、要素の popupanchor 属性に対応する。 align 引数は、要素の popupalign 属性に対応する。 x か y のどちらかが -1 でないときは、 anchor 属性と align 属性は無視される。

指定数ピクセル分、別の要素に相対的にオフセットしてポップアップを表示するには、要素の the boxObject.screenX プロパティと boxObject.screenY プロパティを使って要素の実際のスクリーン位置を決め、引数 x と y が欲しい値のオフセットとなるように、それらを使います。

型は文字列 "popup"、 "context"、 "tooltip" のどれかである必要がある。ポップアップの各型は、一時的に表示されることだけを意図しています。永続的に表示することは考えていません。一度には一つのポップアップのみ、表示することができる。下の例は、 someButton ボタンの左下端にアンカーされたポップアップを開きます。

  menupopup.showPopup (someButton,-1,-1,"popup","bottomleft","topleft");  

sizeTo ( width , height )

Return Type: no return value

Changes the current size of the popup to a new width and height.

戻り値の型 : 戻り値なし

ポップアップの現在のサイズを、新しい幅と高さに変更する。


Copyright (C) 1999 - 2004 XulPlanet.com