Quantcast

* Expose TomTom:InitializeDropdown(uid) that can be used to init the dropdown

James Whitehead II [04-06-08 - 11:26]
* Expose TomTom:InitializeDropdown(uid) that can be used to init the dropdown
* Fix a bug where checkboxes could be put in the wrong place on dropdown menus
Filename
TomTom.lua
diff --git a/TomTom.lua b/TomTom.lua
index 548507c..5273f69 100755
--- a/TomTom.lua
+++ b/TomTom.lua
@@ -457,11 +457,19 @@ local function init_dropdown(level)
 			for k,v in pairs(entry) do new[k] = v end
 			new.checked = new.checked()
 			entry = new
+		else
+			entry.checked = nil
 		end
+
 		UIDropDownMenu_AddButton(entry, level)
 	end
 end

+function TomTom:InitializeDropdown(uid)
+	self.dropdown.uid = uid
+	UIDropDownMenu_Initialize(self.dropdown, init_dropdown)
+end
+
 function TomTom:UIDIsSaved(uid)
 	local data = waypoints[uid]
 	if data then
@@ -504,8 +512,7 @@ end
 --  Define callback functions
 -------------------------------------------------------------------]]--
 local function _both_onclick(event, uid, self, button)
-	TomTom.dropdown.uid = uid
-	UIDropDownMenu_Initialize(TomTom.dropdown, init_dropdown)
+	TomTom:InitializeDropdown(uid)
 	ToggleDropDownMenu(1, nil, TomTom.dropdown, "cursor", 0, 0)
 end