MenuAction (クラス)
public sealed MenuAction {inherits MenuItem, CommandBinding}
インポート元: CURL.GUI.STANDARD. package 内で定義されています CURL.GUI.BASE.

コマンドを実行するメニューのアイテム。

説明

MenuAction は、選択されると、自身に Action イベントを送信することによって関連するアクションをアクティブにします。
詳細および例については、『Curl 開発者ガイド』の「メニュー」のセクションを参照してください。

プログラミング注意事項

MenuBarSubMenu、または MenuPane に対する子としてのみ作成します。

ビジュアル テスト

このクラスは、CurlMenuAction ビジュアル テスト タイプを実装します。

すべての Visual によってサポートされる既定のビジュアル テスト アクションの他に、このクラスのオブジェクトは次のアクションをサポートします。
アクション 引数 説明
Click <none> ボタンをクリックします。

注意事項

このオブジェクトは、"MenuAction"のスタイル ルールを記述することによりスタイル化することが出来ます。

コンストラクタ
default:
コンストラクタ public {MenuAction.default
label:Label = "",
icon:#Graphic = null,
key-access:char = 0,
key-accel-string:#String = null,
add-icon-space?:bool = true,
add-key-space?:bool = true,
bound-command:#Command = null,
text-breakable?:bool = false,
...
}

プロパティ
enabled?:Visual が有効であるかどうかを指定します。
非ローカル オプション public MenuAction.enabled?:bool
style-element:スタイリングの目的のための、この Visual の "要素" や "型" です。
アクセサ public MenuAction.style-element:String
test-description:ビジュアル テスト インフラストラクチャがこのオブジェクトの説明に使用する名前。エンド ユーザーはこの名前で視覚的にオブジェクトを探すことができます。
アクセサ public MenuAction.test-description:#String
test-type-name:このオブジェクトをテストのメソッドとプロパティにマッピングするために、ビジュアル テスト インフラストラクチャが使用するタイプ名。
アクセサ public MenuAction.test-type-name:#String
プロパティ 継承 MenuItem: anchor-rect, cascade-marker-frame, control-color, icon, icon-frame, item-active?, label, menu-bar, menu-context
プロパティ 継承 CommandBinding: bound-command, bound-command-impl
プロパティ 継承 HBox: clonable-class?, framelike-stretch?, valign, vstretch?
プロパティ 継承 HVBox: display-context, distribution, spacing
プロパティ 継承 EventTarget: event-handlers
プロパティ 継承 LengthBreadthBox: first-elastic, second-elastic
プロパティ 継承 SequenceBox: child-array, completely-clonable-children?, contains-valid?, graphical-children, invalid-epoch, layouts-have-valid-sequence-number?, option-register-proc, ordered-children, registered-option-keys, reverse-ordered-children
プロパティ 継承 GetBoundsBox: layout-locally-valid?, layout-valid?
プロパティ 継承 Box: clip-child-shadows?
プロパティ 継承 Graphic: avoid-page-break?, background, border-color, border-spec, border-style, border-width, cell-border-spec, cell-border-width, cell-margin, discrete-select-in-range?, graphic-selectable, height, horigin, is-paginating?, layout, margin, opaque-to-events?, option-parent, outside-margin, pagination-state, parent, possibly-displayed?, selection-context, shadow-color, shadow-spec, visible?, visual-parent, vorigin, width
プロパティ 継承 Visual: _style-element, cursor, data-source, dragee, font-size, graphical-parent, has-key-focus?, input-method-enabled?, input-method-keyboard-mode, name, options, style-class, style-manager, style-options, test-child?, test-name, test-parent?, test-visible?, tooltip, user-data
プロパティ 継承 DataBindingTarget: data-binding-context, data-bindings
プロパティ 継承 OptionListInterface: options-present-here

メソッド
end-menu-traversal-and-fire-action:self.enabled? の場合、自身の Action イベントをキューに入れ、メニューのトラバースを止めます。
public {MenuAction.end-menu-traversal-and-fire-action}:void
fire-action:self.enabled?true の場合、selfAction イベントをキューに入れます。
protected {MenuAction.fire-action}:void
on-action:Action イベントのスタティック イベント ハンドラ
public {MenuAction.on-action e:Action}:void
on-command-changed:CommandChanged イベントのスタティック イベント ハンドラ
public {MenuAction.on-command-changed e:CommandChanged}:void
on-pointer-enter:PointerEnter イベントのスタティック イベント ハンドラ
public {MenuAction.on-pointer-enter e:PointerEnter}:void
on-pointer-event:PointerEventスタティック イベント ハンドラ
public {MenuAction.on-pointer-event e:PointerEvent}:void
on-pointer-leave:PointerLeave イベントのスタティック イベント ハンドラ
public {MenuAction.on-pointer-leave e:PointerLeave}:void
on-pointer-press:PointerPress イベントのスタティック イベント ハンドラ
public {MenuAction.on-pointer-press e:PointerPress}:void
on-pointer-release:PointerRelease イベントのスタティック イベント ハンドラ
public {MenuAction.on-pointer-release e:PointerRelease}:void
take-action:この MenuItem にあったアクションを実行します。
public {MenuAction.take-action}:void
test-run:オブジェクトに対してビジュアル テスト アクションを実行します。
public {MenuAction.test-run action:String, args:FastArray}:any
unselect-item:この MenuItemの選択を解除します。
public {MenuAction.unselect-item}:void
メソッド 継承 MenuItem: add, add-option, become-active-item, highlight, on-grab-release, remove-option, unhighlight, walk-items
メソッド 継承 CommandBinding: handle-observer-message
メソッド 継承 HBox: clone-appearance-helper, get-range-as-selected-text, paginate
メソッド 継承 Observer: observe, stop-observing
メソッド 継承 GuiEventTarget: handle-delegate-event, handle-event, on-cancel-mode, on-commit, on-composition-change-event, on-composition-result-event, on-context-menu-event, on-current-record-change-request, on-current-record-changed, on-destroy-notify, on-destroy-requested, on-drag-over, on-drag-pointer, on-drag-started, on-drop, on-end-composition-event, on-focus-event, on-focus-in, on-focus-out, on-gesture, on-gesture-begin, on-gesture-end, on-gesture-magnify, on-gesture-pan, on-gesture-rotate, on-gesture-swipe, on-gesture-tap, on-gesture-touch, on-gui-event, on-input-method-event, on-key-event, on-key-press, on-pointer-button, on-pointer-crossing, on-pointer-motion, on-pointer-scroll, on-raw-key-event, on-raw-key-press, on-raw-key-release, on-reset, on-selectable-added, on-selectable-removed, on-selection-changed, on-selection-context-activated, on-selection-context-deactivated, on-selection-event, on-start-composition-event, on-start-event, on-stop-event, on-view-activate, on-view-deactivate, on-window-close, remove-event-handlers-for-event-class
メソッド 継承 HVBox: allocate-breadth, allocate-length, compute-breadth-elastic, compute-length-elastic, option-changed, recompute-first-elastic, recompute-our-layout, recompute-second-elastic, set-spacing
メソッド 継承 EventTarget: accepts-event-class?, add-event-handler, event-handler-present?, remove-event-handler, verify-event
メソッド 継承 LengthBreadthBox: allocate-layout-object, attempt-revalidate-layout, check-property, constrain-height, constrain-width, get-height-preference, get-width-preference, propagate-request-layout, revalidate-second-elastic, set-size
メソッド 継承 BasicEventTarget: enqueue-event
メソッド 継承 SequenceBox: add-at-index, add-at-index-with-layout, after-reposition, before-reposition, clear, compare-children, draw, end-pagination, find, graphical-child-visible-at, internal-remove-child, note-attached, note-detaching, notify-option-children, pick-child, register-options, request-draw, request-pointer-trace, swap-children, validate-layout-sequence-numbers
メソッド 継承 BasicBox: contains-point?, find-graphic-at, handle-crossing, on-pointer-envelope-event, pointer-enter-occurred, pointer-leave-occurred
メソッド 継承 GetBoundsBox: get-bounds, get-elastic-bounds-into, get-nonparent-bounds-into, request-layout, validate-layout
メソッド 継承 Box: find-test-children, get-delimited-child-text-selection, get-gui-path-to-child, get-visible-rect-in-root-into, make-gui-mark, search-next-here, search-prev-here
メソッド 継承 Graphic: create-pagination-state, detach, draw-range-as-selected, draw-shadow, find-ancestor, find-graphical-ancestor, fire-inferior-crossing-event, get-graphical-root, get-gui-path, get-origin-in-graphical-ancestor, get-origin-in-root, get-pagination-state, get-top-left-in-ancestor, get-visible-bounds-into, on-drag-enter, on-inspection, paint-with-decorations, replace-with, request-draw-rect, search-next, search-prev, set-layout, start-pagination, xy-offset-to
メソッド 継承 Visual: add-from-init-args, animate, change-cursor, clonable-appearance?, clone-appearance, get-focus-manager, get-layout-context, get-test-parent, get-test-property, get-text, get-view, maybe-fire-attach-event, maybe-fire-detach-event, non-keyword-init-arg, note-caret-position, on-drag-leave, pop-cursor, prepare-test-object, prepare-test-parent, push-cursor, quantize-width, refresh-style-options, release-key-focus, request-key-focus, scroll-to-include, test-record, transform-from-display-coordinates, transform-from-graphical-root-coordinates, transform-to-display-coordinates, transform-to-graphical-root-coordinates
メソッド 継承 GraphicOptions: any-to-Distance, get-display-context
メソッド 継承 DataBindingTarget: add-data-binding, get-data-binding, refresh-data-binding, remove-data-binding, unset-property, update-data-binding, validate-data-binding
メソッド 継承 OptionListInterface: add-style-option, change-option-parent-notify, clone-options, get-option, get-option-by-name, keyword-init-arg, local-add-notify, local-remove-notify, name-to-option-key, new-option-item, option-change-notify, option-lookup, option-lookup-here, option-propagate-notify, option-set?, propagate-option-change, remove-style-option, remove-styles, set-option-by-name, set-style-option-by-name, unset-option-by-name, unset-style-option-by-name
メソッド 継承 InitRestArgParser: process-rest-args
メソッド 継承 Object: object-describe, object-describe-for-debugging, object-serialize



コンストラクタ詳細
default (コンストラクタ)
public {MenuAction.default
label:Label = "",
icon:#Graphic = null,
key-access:char = 0,
key-accel-string:#String = null,
add-icon-space?:bool = true,
add-key-space?:bool = true,
bound-command:#Command = null,
text-breakable?:bool = false,
...
}
label:
MenuAction のラベル。
ポインタ イベントを処理するコントロールやグラフィックをラベルとして使用することは推奨されません。この MenuAction を含む MenuPaneMenuBar はポインタをグラブし、キーボード イベントも処理します。これにより、多くのコントロールが正常に動作しなくなります。
key-access: このアクションに関するアクセス キーを表す文字です。このアクションが発生する MenuPane が開かれている場合に、この文字を押すとコマンドがアクティブになります。
key-accel-string: これが設定されると、設定された key-accel-string を使用して KeyAccel が作成され、MenuAction のラベルの右側に適切な文字列を表示します。この文字列の作成方法に関する詳細の説明は、KeyAccel を解釈する KeyPressMatcher を参照してください。
add-icon-space?, add-key-space?: true (既定値) の場合は、アイコンとアクセラレータ キーの MenuAction の左右にスペースを残します。
bound-command: この MenuAction にバインドするオプションの Command。指定した場合、このコマンドは、メニュー アクションの enabled? 状態を判断し、ActionMenuAction で発生すると既定で実行されます。詳細については、CommandBindingを参照してください。

注意事項

key-accel-string のより詳細な情報とサンプルは、Curl 開発者ガイドの キーボードアクセラレータ の項目を参照して下さい。
アクセスキーはテキストラベルにニーモニックマーク文字 ('&') を使用することでより簡単に設定できます。mark-mnemonic を御覧下さい。key-access パラメータは、キーアクセスの文字をラベルに表示させない場合に便利です。より key-access についての情報は メニュー アクセス キーとニーモニック を御参照下さい。



プロパティ詳細
enabled? (非ローカル オプション)
public MenuAction.enabled?:bool

Visual が有効であるかどうかを指定します。

説明

このオプションが false の場合、オブジェクトやGUI オブジェクトとのユーザー インタラクションは無効になります。
このオプションを true に設定する代わりに、オプションを unset する方が一般的です。これにより、一部の親コンテナの値は、有効な値を判別します。
  • このオプションが false の場合、オプションに応じて、テキストは disabled-color および disabled-text-sunken? で表示されます。


    {paragraph I am enabled}
    {paragraph enabled? = false, I'm not}
    
  • このオプションが false で、Visual がコントロールの場合、コントロールのユーザー インターフェイスは無効になります。前述したように、ラベル上の任意のテキストは、無効状態で表示されます。
    さらに、コントロールに ReactiveLabel があれば、ラベルは既定ラベルの代わりに ReactiveLabel.label-disabled のプロパティを表示します。


    {radio-buttons 
        value = "first",
        {RadioButton radio-value = "first"},
        {RadioButton
            radio-value = "second",
            reactive-label = {ReactiveLabel
                                 label-disabled = "(second)"
                             },
            enabled? = false
        },
        {RadioButton radio-value = "third"}
    }
    


style-element (アクセサ)
アクセサ public MenuAction.style-element:String

スタイリングの目的のための、この Visual の "要素" や "型" です。

説明

この実装によって Visual._style-elementの値が返されますが、通常は定数を返すためにオーバーライドされます。

オーバーライド

Visual のサブクラスのスタイルが他のオブジェクトと異なる場合、このゲッターは適切な文字列を返すようにオーバーライドされる必要があります。 慣例では,この文字列はクラス名または、オブジェクトを生成するマークアップの名前です。
オーバーライドでは、空の文字列でないかぎり、self._style-elementを返さなければなりません。
導入: バージョン 6.0


test-description (アクセサ)
アクセサ public MenuAction.test-description:#String

ビジュアル テスト インフラストラクチャがこのオブジェクトの説明に使用する名前。エンド ユーザーはこの名前で視覚的にオブジェクトを探すことができます。

説明

これは、ビジュアル テスト インフラストラクチャを実行するテスト ツールのユーザー インターフェイスに表示される値です。
既定では、この値はこのオブジェクトを参照する Label (ある場合) を探して取得されます。独自の説明が設定されているオブジェクトは、このメソッドをオーバーライドする必要があります。たとえば、CommandButton には内部の Label が含まれているため、その Lavel の値を返します。
test-name も参照してください。


test-type-name (アクセサ)
アクセサ public MenuAction.test-type-name:#String

このオブジェクトをテストのメソッドとプロパティにマッピングするために、ビジュアル テスト インフラストラクチャが使用するタイプ名。

説明

ビジュアル テストを正しく実行するには、テストは次のいずれかのタイプでなければなりません。特定のテスト タイプの詳細については、リストされている実装例の test-run および get-test-property メソッドの説明を参照してください。
オブジェクトのセマンティクスに近い、いずれかの定義済みテスト タイプの使用を検討してください。ただし、テスト タイプを変更せずにオブジェクトにテストのアクションとプロパティを追加する方が簡単な場合もあります。





メソッド詳細
end-menu-traversal-and-fire-action (メソッド)
public {MenuAction.end-menu-traversal-and-fire-action}:void

self.enabled? の場合、自身の Action イベントをキューに入れ、メニューのトラバースを止めます。

導入: バージョン 6.0


fire-action (メソッド)
protected {MenuAction.fire-action}:void

self.enabled?true の場合、selfAction イベントをキューに入れます。

導入: バージョン 6.0


on-action (メソッド)
public {MenuAction.on-action e:Action}:void

Action イベントのスタティック イベント ハンドラ

説明

スタティック イベント ハンドラの一般的な情報については、GuiEventTarget.on-pointer-event を参照してください。


on-command-changed (メソッド)
public {MenuAction.on-command-changed e:CommandChanged}:void

CommandChanged イベントのスタティック イベント ハンドラ

説明

スタティック イベント ハンドラの一般的な情報については、GuiEventTarget.on-pointer-event を参照してください。


on-pointer-enter (メソッド)
public {MenuAction.on-pointer-enter e:PointerEnter}:void

PointerEnter イベントのスタティック イベント ハンドラ

説明

スタティック イベント ハンドラの一般的な情報については、GuiEventTarget.on-pointer-event を参照してください。


on-pointer-event (メソッド)
public {MenuAction.on-pointer-event e:PointerEvent}:void

PointerEventスタティック イベント ハンドラ

e: 発生した PointerEvent

オーバーライド

このメソッドは、PointerEvent のスタティック ハンドラを提供するためにオーバーライドします。このメソッドをオーバーライドする標準的な方法は、以下のとおりです。

  1. 最初に、現在のオブジェクトの代わりに実行すべき演算を行います。
  2. 次に、{super.on-pointer-event e} を呼び出します。


(1) の演算でイベントが消費されると考えられる場合、イベントで GuiEvent.consume を呼び出してこれを示します。ただし、この場合でも上記の 2 つの手順をその後で実行してください。消費されていないイベントに対してのみ実行されるスタティック イベント ハンドラは、GuiEvent.consumed? をチェックして、イベントがすでに消費されているかどうかを調べることができます。

注意事項

すべてのスタティック イベント ハンドラ (on-... 形式の名前を持つ GuiEventTarget のメソッド) でこれと類似した動作が行われ、それらすべてにオーバーライドについての同じ注意事項が適用されます。


on-pointer-leave (メソッド)
public {MenuAction.on-pointer-leave e:PointerLeave}:void

PointerLeave イベントのスタティック イベント ハンドラ

説明

スタティック イベント ハンドラの一般的な情報については、GuiEventTarget.on-pointer-event を参照してください。


on-pointer-press (メソッド)
public {MenuAction.on-pointer-press e:PointerPress}:void

PointerPress イベントのスタティック イベント ハンドラ

説明

スタティック イベント ハンドラの一般的な情報については、GuiEventTarget.on-pointer-event を参照してください。


on-pointer-release (メソッド)
public {MenuAction.on-pointer-release e:PointerRelease}:void

PointerRelease イベントのスタティック イベント ハンドラ

説明

スタティック イベント ハンドラの一般的な情報については、GuiEventTarget.on-pointer-event を参照してください。


take-action (メソッド)
public {MenuAction.take-action}:void

この MenuItem にあったアクションを実行します。

説明

MenuItem.item-active?true の場合、MenuAction を起動します。このメソッドを MenuAction で呼び出すことで、メニューのトラバースを終了させます。
SubMenu では、これは SubMenu を開きます。
これは、通常 enter キーが押されてメニュー アイテムがアクティブになると呼び出されます。
導入: バージョン 6.0


test-run (メソッド)
public {MenuAction.test-run action:String, args:FastArray}:any

オブジェクトに対してビジュアル テスト アクションを実行します。

action: 実行するアクションの名前。
args: ビジュアル テスト アクションの引数。ビジュアル テスト インフラストラクチャは、引数の数と型をチェックしますが、値はチェックしません。実装では、すべての有効な値を処理し、不正な値に対しては例外またはエラーをスローするようにしてください。

説明

そのクラスによってサポートされたテスト動作のリストについてクラスのドキュメントを御読み下さい。
既定の実装では、RawClick などの一般的な操作を処理し、action が既知のアクションに一致しない場合にはリフレクションを使用してメソッドを呼び出します。

注意事項

QuickTest Property™ のビジュアル テスト環境では、任意の実行時メソッドを直接呼び出せません。代わりに CallMethod アクションを使用して、最初の引数としてメソッド名を渡してください。ビジュアル テスト インフラストラクチャは、CallMethod アクションを実際のアクションに変換してから test-run を呼び出します。

注意事項

参照:canonical-test-value

オーバーライド

新しいテスト アクションを追加するには、action と新しいアクションの名前を照合します。一致する場合は、引数を処理してアクションを実行し、適切なタイプの値 (戻り値がない場合は null) を返します。action が新しいテスト アクションに一致しない場合は、super.test-run を呼び出します。


unselect-item (メソッド)
public {MenuAction.unselect-item}:void

この MenuItemの選択を解除します。

導入: バージョン 6.0