Skip to main content

FlxUIDropDownMenuCustom

Kindclass
Packageobjects
Full nameobjects.FlxUIDropDownMenuCustom
Sourcesource/objects/FlxUIDropDownMenuCustom.hx
ExtendsFlxUIGroup
ImplementsIFlxUIWidget, IFlxUIClickable, IHasParams

@author larsiusprime

Public fields​

NameTypeStaticDefaultNotes
skipButtonUpdateBoolno—property (default, set)
selectedIdStringno—property (get, set)
selectedLabelStringno—property (get, set)
canScrollBoolnotrue—
headerFlxUIDropDownHeaderno—The header of this dropdown menu.
listArray<FlxUIButton>no[]The list of items that is shown when the toggle button is clicked.
dropPanelFlxUI9SliceSpriteno—The background for the list.
paramsArray<Dynamic>no—property (default, set)
dropDirectionFlxUIDropDownMenuDropDirectionnoDownproperty (default, set)
CLICK_EVENTStringyes"click_dropdown"—
callbackString->Voidno——

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

ParameterTypeDefault
X (optional)Float0
Y (optional)Float0
DataListArray<StrNameLabel>—
Callback (optional)String->Void, ?Header:FlxUIDropDownHeader, ?DropPanel:FlxUI9SliceSprite, ?ButtonList:Array<FlxUIButton>, ?UIControlCallback:Bool->FlxUIDropDownMenuCustom->Void—

View source

setData​

function setData(DataList:Array<StrNameLabel>):Void

Change the contents with a new data list Replaces the old content with the new content

ParameterTypeDefault
DataListArray<StrNameLabel>—

View source

changeLabelByIndex​

function changeLabelByIndex(i:Int, NewLabel:String):Void
ParameterTypeDefault
iInt—
NewLabelString—

View source

changeLabelById​

function changeLabelById(name:String, NewLabel:String):Void
ParameterTypeDefault
nameString—
NewLabelString—

View source

getBtnByIndex​

function getBtnByIndex(i:Int):FlxUIButton
ParameterTypeDefault
iInt—

View source

getBtnById​

function getBtnById(name:String):FlxUIButton
ParameterTypeDefault
nameString—

View source

update​

override function update(elapsed:Float):Void
ParameterTypeDefault
elapsedFloat—

View source

destroy​

override function destroy():Void

View source

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

ParameterTypeDefault
StringArrayArray<String>—
UseIndexID (optional)Boolfalse

View source

Internals​

Private / internal members
FieldTypeStatic
_selectedIdStringno
_selectedLabelStringno
currentScrollIntno
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