View Single Post
05-31-22, 12:48 PM   #2
urnati
A Kobold Labourer
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1
Hi-
There is a lot to unpack here. First I should say I am not familiar with WeakAuras but am familiar with drop downs.

You first attempt of a post hook was close. However the routine to hook could be WardrobeFilterDropDown_InitializeBaseSets. It just builds the drop down on the fly as needed on mouse down per the Blizzard XML. Hooking the mouse click may be too 'late' or be inconsistent in behavior.
Possibly use hooksecurefunc("WardrobeFilterDropDown_InitializeBaseSets", <your routine>)

By the way, the Blizzard code I see in Blizzard_Wardrobe.lua is below. If the example code is from another addon, it could be tricky. The technique should work but the example appears to use a specialized library / utility that may do something to hinder a hook.
Code:
function WardrobeFilterDropDown_InitializeBaseSets(self, level)
	local info = UIDropDownMenu_CreateInfo();
	info.keepShownOnClick = true;
	info.isNotRadio = true;

	info.text = COLLECTED;
	info.func = function(_, _, _, value)
					C_TransmogSets.SetBaseSetsFilter(LE_TRANSMOG_SET_FILTER_COLLECTED, value);
				end
	info.checked = C_TransmogSets.GetBaseSetsFilter(LE_TRANSMOG_SET_FILTER_COLLECTED);
	UIDropDownMenu_AddButton(info, level);
...
Then add your buttons in <your routine>.
Code:
function <your routine>(self, level)
        UIDropDownMenu_AddSeparator()
        local info = UIDropDownMenu_CreateInfo();
        
        info.text = "New Button";
        info.isTitle = true;
        info.notCheckable = true;
        UIDropDownMenu_AddButton(info, 1);
end
WardrobeFilterDropDown_InitializeBaseSets will have set up the frame for you. Your buttons should be at the bottom.

You may want to wait until the event(e) == PLAYER_ENTERING_WORLD to ensure all addons are loaded or the hook could fail.
  Reply With Quote