Skip to content
João Cardoso edited this page Dec 5, 2019 · 3 revisions

DropChoice is a frame class which inherits from Labeled and UIDropDownMenuTemplate.

Preview

Methods

Name Description
SetValue(value) Sets which line is selected in the dropdown, identified by "value".
GetValue()
AddChoices(value [,name] [,tip]) Adds a new line to the dropdown, identified by value. If name is not provided, value will be used as the display text. If tip is set, a mouse-hover tooltip will be provided for the line.
AddChoices(choice) Same as above, but using table form.
AddChoices(choices) If a list of choices is provided, the object will iterate to register them all.
GetChoices()

Calls

Name Description
OnSelection (value), OnInput (value) Fired when a dropdown's line is selected by the user. Passes the line's identifier value.
OnUpdate Fired when a dropdown's line is selected by the user, after the other calls.

Example

local myMenu = LibStub('Sushi-3.1').Choice(MyParent)
myMenu:SetPoint('CENTER')

myMenu:SetLabel('My Awesome Dropdown')
myMenu:AddChoice('Salmon')
myMenu:AddChoice('Grouper')
myMenu:AddChoice('None')

myMenu:SetCall('OnInput', function(self, value)
 if value == 'None' then
  print('Not hungry?')
 else
  print('You cannot have it.')
 end
end)

Sushi-3.1 🍣

Documentation
Class Reference
Best Practices

Feedback
Post an issue

Clone this wiki locally