层级 (查看完整内容)

构造函数

  • 参数

    • 可选res: string

      The resource URL of the popup menu. If not defined, the default internal resource will be used.

    • 可选seperatorRes: string

      The resource URL of the seperator. If not defined, the default internal resource will be used.

    返回 PopupMenu

    Create a popup menu.

    创建一个弹出菜单。

属性

autoSize: boolean = false
hideOnClickItem: boolean = true
visibleItemCount: number = 0

访问器

方法

  • 参数

    • caption: string

      The caption of the item.

    • 可选callback: Function

      The callback function when the item is clicked.

    • 可选target: any

      The callback function's this object.

    返回 GWidget

    The created item.

    Add an item to the popup menu.

    向弹出菜单中添加一个菜单项。

  • 参数

    • caption: string

      The caption of the item.

    • index: number

      The index to add the item.

    • 可选callback: Function

      The callback function when the item is clicked.

    • 可选target: any

      The callback function's this object.

    返回 GWidget

    The created item.

    Add an item to the popup menu at a specified index.

    在指定索引处向弹出菜单中添加一个菜单项。

  • 参数

    • 可选index: number

      The index to add the seperator.

    返回 void

    Add a seperator to the popup menu.

    向弹出菜单中添加一个分隔符。

  • 参数

    • type: string

      The type of event.

    • 可选data: any

      (Optional) Data to pass to the callback. If multiple parameters p1, p2, p3, ... need to be passed, use an array structure such as [p1, p2, p3, ...]. If a single parameter p needs to be passed and p is an array, use a structure such as [p]. For other single parameters p, you can directly pass parameter p. If data is Event.EMPTY, it means passing an Event object to the callback function. Note that it is not passing Event.TEMP, but an independent Event object.

    返回 boolean

    True if there are listeners for this event type, false otherwise.

    Dispatch an event.

    派发事件。

  • 参数

    • index: number

      The index of the item.

    返回 string

    The name of the item.

    Get the name of the item at a specified index.

    获取指定索引处菜单项的名称。

  • 参数

    • type: string

      The type of event.

    返回 boolean

    True if a listener of the specified type is registered, false otherwise.

    Check if the EventDispatcher object has any listeners registered for a specific type of event.

    检查 EventDispatcher 对象是否为特定事件类型注册了任何侦听器。

  • 参数

    • name: string

      The name of the item.

    返回 boolean

    The checked state of the item.

    Get the checked state of the item with the specified name.

    获取指定名称菜单项的选中状态。

  • 参数

    • type: string

      The type of event.

    • listener: Function

      The listener function.

    返回 EventDispatcher

    This EventDispatcher object.

    Register an event listener object with the EventDispatcher object so that the listener receives event notifications.

    使用 EventDispatcher 对象注册指定类型的事件侦听器对象,以使侦听器能够接收事件通知。

  • 参数

    • type: string

      The type of event.

    • caller: any

      The execution scope of the event listener function.

    • listener: Function

      The listener function.

    • 可选args: any[]

      (Optional) The callback parameters of the event listener function.

    返回 EventDispatcher

    This EventDispatcher object.

    Register an event listener object with the EventDispatcher object so that the listener receives event notifications.

    使用 EventDispatcher 对象注册指定类型的事件侦听器对象,以使侦听器能够接收事件通知。

  • 参数

    • type: string

      The type of event.

    • listener: Function

      The listener function.

    返回 EventDispatcher

    This EventDispatcher object.

    Register an event listener object with the EventDispatcher object so that the listener receives event notifications. This event listener responds once and is automatically removed after the first call.

    使用 EventDispatcher 对象注册指定类型的事件侦听器对象,以使侦听器能够接收事件通知,此侦听事件响应一次后自动移除。

  • 参数

    • type: string

      The type of event.

    • caller: any

      The execution scope of the event listener function.

    • listener: Function

      The listener function.

    • 可选args: any[]

      (Optional) The callback parameters of the event listener function.

    返回 EventDispatcher

    This EventDispatcher object.

    Register an event listener object with the EventDispatcher object so that the listener receives event notifications. This event listener responds once and is automatically removed after the first call.

    使用 EventDispatcher 对象注册指定类型的事件侦听器对象,以使侦听器能够接收事件通知,此侦听事件响应一次后自动移除。

  • 参数

    • name: string

      The name of the item.

    返回 boolean

    Whether the item is removed successfully.

    Remove the item with the specified name.

    移除指定名称的菜单项。

  • 参数

    • name: string

      The name of the item.

    • checkable: boolean

      The checkable state to set.

    返回 void

    Set the checkable state of the item with the specified name.

    设置指定名称菜单项的可选中状态。

  • 参数

    • name: string

      The name of the item.

    • checked: boolean

      The checked state to set.

    返回 void

    Set the checked state of the item with the specified name.

    设置指定名称菜单项的选中状态。

  • 参数

    • name: string

      The name of the item.

    • grayed: boolean

      The grayed state to set.

    返回 void

    Set the grayed state of the item with the specified name.

    设置指定名称菜单项的灰显状态。

  • 参数

    • name: string

      The name of the item.

    • caption: string

      The caption to set.

    返回 void

    Set the text of the item with the specified name.

    设置指定名称菜单项的文本。

  • 参数

    • name: string

      The name of the item.

    • visible: boolean

      The visibility to set.

    返回 void

    Set the visibility of the item with the specified name.

    设置指定名称菜单项的可见性。