FlxUIDropDownMenuCustom
| Kind | class |
| Package | objects |
| Full name | objects.FlxUIDropDownMenuCustom |
| Source | source/objects/FlxUIDropDownMenuCustom.hx |
| Extends | FlxUIGroup |
| Implements | IFlxUIWidget, IFlxUIClickable, IHasParams |
@author larsiusprime
Public fields
| Name | Type | Static | Default | Notes |
|---|---|---|---|---|
skipButtonUpdate | Bool | no | — | property (default, set) |
selectedId | String | no | — | property (get, set) |
selectedLabel | String | no | — | property (get, set) |
canScroll | Bool | no | true | — |
header | FlxUIDropDownHeader | no | — | The header of this dropdown menu. |
list | Array<FlxUIButton> | no | [] | The list of items that is shown when the toggle button is clicked. |
dropPanel | FlxUI9SliceSprite | no | — | The background for the list. |
params | Array<Dynamic> | no | — | property (default, set) |
dropDirection | FlxUIDropDownMenuDropDirection | no | Down | property (default, set) |
CLICK_EVENT | String | yes | "click_dropdown" | — |
callback | String->Void | no | — | — |
Public methods
new (constructor)
function new(X:Float = 0, Y:Float = 0, DataList:Array<StrNameLabel>, ?Callback:String->Void, ?Header:FlxUIDropDownHeader,
?DropPanel:FlxUI9SliceSprite, ?ButtonList:Array<FlxUIButton>, ?UIControlCallback:Bool->FlxUIDropDownMenuCustom->Void)
This creates a new dropdown menu.
@param X x position of the dropdown menu @param Y y position of the dropdown menu @param DataList The data to be displayed @param Callback Optional Callback @param Header The header of this dropdown menu @param DropPanel Optional 9-slice-background for actual drop down menu @param ButtonList Optional list of buttons to be used for the corresponding entry in DataList @param UIControlCallback Used internally by FlxUI
| Parameter | Type | Default |
|---|---|---|
X (optional) | Float | 0 |
Y (optional) | Float | 0 |
DataList | Array<StrNameLabel> | — |
Callback (optional) | String->Void, ?Header:FlxUIDropDownHeader, ?DropPanel:FlxUI9SliceSprite, ?ButtonList:Array<FlxUIButton>, ?UIControlCallback:Bool->FlxUIDropDownMenuCustom->Void | — |
setData
function setData(DataList:Array<StrNameLabel>):Void
Change the contents with a new data list Replaces the old content with the new content
| Parameter | Type | Default |
|---|---|---|
DataList | Array<StrNameLabel> | — |
changeLabelByIndex
function changeLabelByIndex(i:Int, NewLabel:String):Void
| Parameter | Type | Default |
|---|---|---|
i | Int | — |
NewLabel | String | — |
changeLabelById
function changeLabelById(name:String, NewLabel:String):Void
| Parameter | Type | Default |
|---|---|---|
name | String | — |
NewLabel | String | — |
getBtnByIndex
function getBtnByIndex(i:Int):FlxUIButton
| Parameter | Type | Default |
|---|---|---|
i | Int | — |
getBtnById
function getBtnById(name:String):FlxUIButton
| Parameter | Type | Default |
|---|---|---|
name | String | — |
update
override function update(elapsed:Float):Void
| Parameter | Type | Default |
|---|---|---|
elapsed | Float | — |
destroy
override function destroy():Void
makeStrIdLabelArray
static function makeStrIdLabelArray(StringArray:Array<String>, UseIndexID:Bool = false):Array<StrNameLabel>
Helper function to easily create a data list for a dropdown menu from an array of strings.
@param StringArray The strings to use as data - used for both label and string ID. @param UseIndexID Whether to use the integer index of the current string as ID. @return The StrIDLabel array ready to be used in FlxUIDropDownMenuCustom's constructor
| Parameter | Type | Default |
|---|---|---|
StringArray | Array<String> | — |
UseIndexID (optional) | Bool | false |
Internals
Private / internal members
| Field | Type | Static |
|---|---|---|
_selectedId | String | no |
_selectedLabel | String | no |
currentScroll | Int | no |
| Method |
|---|
function set_skipButtonUpdate(b:Bool):Bool |
function get_selectedId():String |
function set_selectedId(str:String):String |
function get_selectedLabel():String |
function set_selectedLabel(str:String):String |
function set_params(p:Array<Dynamic>):Array<Dynamic> |
function set_dropDirection(dropDirection):FlxUIDropDownMenuDropDirection |
function updateButtonPositions():Void |
override function set_visible(Value:Bool):Bool |
function dropsUp():Bool |
function exceedsHeight():Bool |
function getPanelHeight():Float |
function selectSomething(name:String, label:String):Void |
function makeListButton(i:Int, Label:String, Name:String):FlxUIButton |
function mouseOverlapping() |
function showList(b:Bool):Void |
function onDropdown():Void |
function onClickItem(i:Int):Void |