Thread Tools Display Modes
04/24/14, 03:51 AM   #1
Todo
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 5
DropDown LibStub SetFunc

Hey fellow developers !

When I declare a dropdown (with libstub) and specially the setFunc, I wonder if thre is a way in this function to know the key that bear the dropDown.

I create my dropdown in a loop and I want to do a different treatement for them and for that I need the key to know which dropdown I'm actually working on.

I've been searching in the LibStub files to check if there is something I can do to make this work, and I may have found something.

Code:
function lam:AddDropdown(panelID, controlName, text, tooltip, validChoices, getFunc, setFunc, warning, warningText)
........
ZO_PreHookHandler(dropmenu.m_selectedItemText, "OnTextChanged", function(self)
	if dropmenu.m_selectedItemData then
		selectedName = dropmenu.m_selectedItemData.name
		setText(self, selectedName)
		setFunc(selectedName)
	end
end)
........
I am pretty confident that if I remplace the setFunc line by that :

Code:
setFunc(selectedName,controlName)
It will pass to my function the key of the dropdown.

Do you guys have any others non intrusives solutions ? I don't wanna touch the work of Seerah

Thanks
  Reply With Quote
04/24/14, 01:54 PM   #2
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 648
No. setFunc is the function that you pass through for setting/saving your option when you create the dropdown. See the docs here. (It's LibAddonMenu, by the way, not LibStub.)

Lua Code:
  1. local dropmenu = ZO_ComboBox_ObjectFromContainer(GetControl(dropdown, "Dropdown"))
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » DropDown LibStub SetFunc


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off