Skip to content
Dropdown

界面 / Dropdown

Dropdown Class
​

Dropdown

Hierarchy ​

Table of contents ​

Accessors
​

dropdownStyle(): DropdownStyle client
菜单样式
isOpened(): boolean client
获取菜单是否打开
menuRowStyle(): ListItemStyle client
ListItemStyle样式
onOpeningEvent(): MulticastDelegate<() => void> client
打开下拉菜单前触发事件
onSelectionChangedEvent(): MulticastDelegate<(item: string, select: SelectInfo) => void> client
选中改动事件
optionCount(): number client
获取菜单项数量
options(): string[] client
获取所有菜单项
scrollbarStyle(): ScrollbarStyle client
滚动条样式
selectedOption(): string client
获取当前选中项
selectedOptionIndex(): number client
获取选中项下拉索引
textStyle(): TextStyle client
文本样式
click

Accessors
​

autoSizeHorizontalEnable(): boolean client
获取是否自动水平设置大小
autoSizeVerticalEnable(): boolean client
获取是否自动垂直设置大小
cachedGeometry(): Geometry client
获取上一次的GetTickSpaceGeometry
constraints(): Readonly<UIConstraintAnchors> client
获取控件的布局
desiredSize(): Vector2 client
获取期望大小
enable(): boolean client
是否可用
guid(): string client
获取控件GUID
isHovered(): boolean client
是否是hovered
mouseCursor(): MouseCursor client
获取控件上光标类型
name(): string client
获取名字
onFocusChange(): Delegate<(absolutionPosition: Vector2) => boolean> client
焦点改变事件
onFoucsLost(): Delegate<(absolutionPosition: Vector2) => boolean> client
丢失焦点事件
onKeyDownEvent(): Delegate<(absolutionPosition: Vector2, keyEvent: KeyEvent) => boolean> client
按键按下事件
onKeyUpEvent(): Delegate<(absolutionPosition: Vector2, keyEvent: KeyEvent) => boolean> client
按键抬起事件
onMouseButtonDoubleClick(): Delegate<(absolutionPosition: Vector2, pointEvent: PointerEvent) => boolean> client
鼠标双击事件
onMouseButtonDown(): Delegate<(absolutionPosition: Vector2, pointEvent: PointerEvent) => boolean> client
鼠标按下事件
onMouseButtonUp(): Delegate<(absolutionPosition: Vector2, pointEvent: PointerEvent) => boolean> client
鼠标抬起事件
onMouseEnter(): Delegate<(absolutionPosition: Vector2, pointEvent: PointerEvent) => boolean> client
鼠标进入控件事件
onMouseLeave(): Delegate<(absolutionPosition: Vector2, pointEvent: PointerEvent) => boolean> client
鼠标离开控件事件
onMouseMove(): Delegate<(absolutionPosition: Vector2, pointEvent: PointerEvent) => boolean> client
鼠标移动事件
onMouseWheel(): Delegate<(absolutionPosition: Vector2, pointEvent: PointerEvent) => boolean> client
鼠标滚轮滚动事件
onTouchEnded(): Delegate<(absolutionPosition: Vector2, pointEvent: PointerEvent) => boolean> client
触摸结束事件
onTouchMoved(): Delegate<(absolutionPosition: Vector2, pointEvent: PointerEvent) => boolean> client
触摸移动事件
onTouchStarted(): Delegate<(absolutionPosition: Vector2, pointEvent: PointerEvent) => boolean> client
触摸按下事件
paintSpaceGeometry(): Geometry client
获取最后一次用于渲染Widget的几何信息
parent(): Widget client
获取父节点
position(): Readonly<Vector2> client
获取控件的位置
renderOpacity(): number client
获取渲染透明度
renderScale(): Vector2 client
获取渲染缩放
renderShear(): Vector2 client
获取渲染错切形变
renderTransformAngle(): number client
获取渲染的角度
renderTransformPivot(): Vector2 client
获取渲染锚点
size(): Vector2 client
获取大小
tickSpaceGeometry(): Geometry client
获取最后一次用于驱动Widget Tick的几何信息
transform(): Readonly<UITransform> client
得到控件的大小和位置
visibility(): SlateVisibility client
获取可见性
visible(): boolean client
是否可见
zOrder(): number client
获取zorder

Methods
​

addOption(option: string): void client
添加菜单项
clearOptions(): void client
清空所有菜单项
clearSelection(): void client
清空所有选中
findOptionIndex(option: string): number client
获取下拉顺序坐标
getOptionByIndex(index: number): string client
菜单项内容
getShowTextVisible(): boolean
removeOption(option: string): void client
移除菜单项
setOptionByIndex(index: number, value: string): void client
修改索引处的值
setShowTextVisible(bVisible): void
newObject(parent?: Canvas, inName?: string): Dropdown client
创建Canvas控件 当parent和inName与已有的对象相同时,旧的对象会被销毁
click

Methods
​

addChild(child: Widget): void client
添加子节点
destroyObject(): void client
立刻移除并销毁 不可以在使用
equal(that: Widget): boolean client
判断是不是同一个对象
findChildByPath(inPath: string): Widget client
通过相对路径查找节点
getChildAt(index: number): Widget client
获取第几位子节点
getChildByName<T: extends Widget<T>>(name: string): T: extends Widget<T> client
通过名字查找节点
getChildrenCount(): number client
获取子节点数量
invalidateLayoutAndVolatility(): void client
立刻触发重新渲染的和排布计算
removeAllChildren(): void client
清除所有子节点,会销毁UI无法再使用
removeChild(child: Widget): void client
移除节点,会销毁UI无法在使用
removeChildAt(index: number): void client
移除第几个节点,会销毁UI无法再使用
removeObject(): void client
立刻移除并添加到根节点 可以再使用

Accessors ​


• get dropdownStyle(): DropdownStyle client

菜单样式

Returns ​

DropdownStyle返回菜单样式

isOpened
​

• get isOpened(): boolean client

获取菜单是否打开

Returns ​

boolean菜单是否打开

• get menuRowStyle(): ListItemStyle client

ListItemStyle样式

Returns ​

ListItemStyle返回ListItemStyle样式

onOpeningEvent
​

• get onOpeningEvent(): MulticastDelegate<() => void> client

打开下拉菜单前触发事件

Returns ​

MulticastDelegate<() => void>返回事件

onSelectionChangedEvent
​

• get onSelectionChangedEvent(): MulticastDelegate<(item: string, select: SelectInfo) => void> client

选中改动事件

Returns ​

MulticastDelegate<(item: string, select: SelectInfo) => void>返回选中改动事件

optionCount
​

• get optionCount(): number client

获取菜单项数量

Returns ​

number菜单项数量

options
​

• get options(): string[] client

• set options(value): void client

获取所有菜单项

Returns ​

string[]所有菜单项

获取所有菜单项

Parameters ​

value string[]传进来的字符串数组
range: 不做限制,合理即可。

scrollbarStyle
​

• get scrollbarStyle(): ScrollbarStyle client

滚动条样式

Returns ​

ScrollbarStyle返回滚动条样式

selectedOption
​

• get selectedOption(): string client

• set selectedOption(value): void client

获取当前选中项

Returns ​

string当前选中项

设置前选中项

Parameters ​

value string传进来的文本

selectedOptionIndex
​

• get selectedOptionIndex(): number client

• set selectedOptionIndex(value): void client

获取选中项下拉索引

Returns ​

number选中项下拉索引

设置选中项下拉索引

Parameters ​

value number设置的索引值

textStyle
​

• get textStyle(): TextStyle client

文本样式

Returns ​

TextStyle返回文本样式

Methods ​


addOption
​

• addOption(option): void client

添加菜单项

Parameters ​

option string菜单项
range: 不做限制,合理即可。

clearOptions
​

• clearOptions(): void client

清空所有菜单项


clearSelection
​

• clearSelection(): void client

清空所有选中


findOptionIndex
​

• findOptionIndex(option): number client

获取下拉顺序坐标

Parameters ​

option string菜单项
range: 不做限制,合理即可。

Returns ​

number下拉顺序坐标

getOptionByIndex
​

• getOptionByIndex(index): string client

菜单项内容

Parameters ​

index number下拉顺序坐标
range: 不做限制,合理即可。

Returns ​

string获取菜单项内容

getShowTextVisible
​

• getShowTextVisible(): boolean

获取显示的选中文本的可见性


removeOption
​

• removeOption(option): void client

移除菜单项

Parameters ​

option string菜单项
range: 不做限制,合理即可。

setOptionByIndex
​

• setOptionByIndex(index, value): void client

修改索引处的值

Parameters ​

index number索引
range: 对应的索引值,不做限制。
type: 整数
value string值
range: 不做限制。

setShowTextVisible
​

• setShowTextVisible(bVisible): void

设置显示的选中文本的可见性


newObject
​

• Static newObject(parent?, inName?): Dropdown client

创建Canvas控件 当parent和inName与已有的对象相同时,旧的对象会被销毁

Parameters ​

parent? Canvas创建控件的外parent对象 default:null
inName? string创建控件的名称 default:null
range: 不做限制,合理即可。

Returns ​

Dropdown返回创建的对象
bVisibleboolean