Download
(13 Kb)
Download
Updated: 11-29-13 04:03 PM
Compatibility:
Siege of Orgrimmar (5.4)
Updated:11-29-13 04:03 PM
Created:11-24-13 12:19 PM
Downloads:168
Favorites:5
MD5:
5.4
NoTaint UIDropDownMenu
Version: 1.1
by: another [More]
Standard UIDropDownMenu global functions using protected frames and causing taints when used by third-party addons. But it is possible to avoid taints by using same functionality with that library.
Library checked more than year inside of TinyExtraBars without any taints from menus.

What is it
Library is standard code from Blizzard's files EasyMenu.lua, UIDropDownMenu.lua and UIDropDownMenuTemplates.xml with frames, tables, variables and functions renamed to:
  • constants (typed with all CAPS): "LIB_" added at the start
  • functions: "Lib_" added at the start

Constants
  • LIB_UIDROPDOWNMENU_MINBUTTONS
  • LIB_UIDROPDOWNMENU_MAXBUTTONS
  • LIB_UIDROPDOWNMENU_MAXLEVELS
  • LIB_UIDROPDOWNMENU_BUTTON_HEIGHT
  • LIB_UIDROPDOWNMENU_BORDER_HEIGHT
  • LIB_UIDROPDOWNMENU_OPEN_MENU
  • LIB_UIDROPDOWNMENU_INIT_MENU
  • LIB_UIDROPDOWNMENU_MENU_LEVEL
  • LIB_UIDROPDOWNMENU_MENU_VALUE
  • LIB_UIDROPDOWNMENU_SHOW_TIME
  • LIB_UIDROPDOWNMENU_DEFAULT_TEXT_HEIGHT
  • LIB_OPEN_DROPDOWNMENUS

Functions
  • Lib_EasyMenu
  • Lib_EasyMenu_Initialize
  • Lib_UIDropDownMenuDelegate_OnAttributeChanged
  • Lib_UIDropDownMenu_InitializeHelper
  • Lib_UIDropDownMenu_Initialize
  • Lib_UIDropDownMenu_OnUpdate
  • Lib_UIDropDownMenu_StartCounting
  • Lib_UIDropDownMenu_StopCounting
  • Lib_UIDropDownMenu_CreateInfo
  • Lib_UIDropDownMenu_CreateFrames
  • Lib_UIDropDownMenu_AddButton
  • Lib_UIDropDownMenu_Refresh
  • Lib_UIDropDownMenu_RefreshAll
  • Lib_UIDropDownMenu_SetIconImage
  • Lib_UIDropDownMenu_SetSelectedName
  • Lib_UIDropDownMenu_SetSelectedValue
  • Lib_UIDropDownMenu_SetSelectedID
  • Lib_UIDropDownMenu_GetSelectedName
  • Lib_UIDropDownMenu_GetSelectedID
  • Lib_UIDropDownMenu_GetSelectedValue
  • Lib_UIDropDownMenuButton_OnClick
  • Lib_HideDropDownMenu
  • Lib_ToggleDropDownMenu
  • Lib_CloseDropDownMenus
  • Lib_UIDropDownMenu_OnHide
  • Lib_UIDropDownMenu_SetWidth
  • Lib_UIDropDownMenu_SetButtonWidth
  • Lib_UIDropDownMenu_SetText
  • Lib_UIDropDownMenu_GetText
  • Lib_UIDropDownMenu_ClearAll
  • Lib_UIDropDownMenu_JustifyText
  • Lib_UIDropDownMenu_SetAnchor
  • Lib_UIDropDownMenu_GetCurrentDropDown
  • Lib_UIDropDownMenuButton_GetChecked
  • Lib_UIDropDownMenuButton_GetName
  • Lib_UIDropDownMenuButton_OpenColorPicker
  • Lib_UIDropDownMenu_DisableButton
  • Lib_UIDropDownMenu_EnableButton
  • Lib_UIDropDownMenu_SetButtonText
  • Lib_UIDropDownMenu_DisableDropDown
  • Lib_UIDropDownMenu_EnableDropDown
  • Lib_UIDropDownMenu_IsEnabled
  • Lib_UIDropDownMenu_GetValue

How to use it
  • Add it to your toc.
  • Like ordinal code for UIDropDownMenu with "Lib_" instead.
1.1
Fixed first two menu's strata.
Optional Files (0)


Archived Files (1)
File Name
Version
Size
Author
Date
1.0
13kB
another
11-24-13 12:19 PM


Post A Reply Comment Options
Old 11-29-13, 01:20 PM  
another
A Murloc Raider
AddOn Author - Click to view AddOns

Forum posts: 7
File comments: 160
Uploads: 14
Originally Posted by Resike
Originally Posted by another
It is called for every new list, i.e. for LIB_UIDROPDOWNMENU_MAXLEVELS at first (on addon load) and if you have more for others on Lib_UIDropDownMenu_CreateFrames.
I'm not sure about that, i think that only gets triggered for multi level dropdowns when the new level should be on top of it's parent level:

What I see from sources it is called for LIB_UIDROPDOWNMENU_MAXLEVELS (2)
Code:
for i = 1, LIB_UIDROPDOWNMENU_MAXLEVELS do
	local listFrameName = "Lib_DropDownList"..i;	
	local f = CreateFrame("Button", listFrameName, nil, "Lib_UIDropDownListTemplate");
and
Code:
function Lib_UIDropDownMenu_CreateFrames(level, index)

	while ( level > LIB_UIDROPDOWNMENU_MAXLEVELS ) do
		LIB_UIDROPDOWNMENU_MAXLEVELS = LIB_UIDROPDOWNMENU_MAXLEVELS + 1;
		local newList = CreateFrame("Button", "Lib_DropDownList"..LIB_UIDROPDOWNMENU_MAXLEVELS, nil, "Lib_UIDropDownListTemplate");
		newList:SetFrameStrata("FULLSCREEN_DIALOG");
So it seems first 2 really created with lowered strata. Hmm. While new UIDropDownMenu.xml creates first 2 lists with frameStrata="FULLSCREEN_DIALOG". I think
Code:
	f:SetFrameStrata("FULLSCREEN_DIALOG");
somewhere at line 27 would fix it.
another is offline Report comment to moderator  
Reply With Quote
Old 11-29-13, 06:41 AM  
Resike
A Molten Giant
AddOn Author - Click to view AddOns

Forum posts: 527
File comments: 212
Uploads: 10
Originally Posted by another
It is called for every new list, i.e. for LIB_UIDROPDOWNMENU_MAXLEVELS at first (on addon load) and if you have more for others on Lib_UIDropDownMenu_CreateFrames.
I'm not sure about that, i think that only gets triggered for multi level dropdowns when the new level should be on top of it's parent level:

Last edited by Resike : 11-29-13 at 06:41 AM.
Resike is offline Report comment to moderator  
Reply With Quote
Old 11-25-13, 04:56 PM  
another
A Murloc Raider
AddOn Author - Click to view AddOns

Forum posts: 7
File comments: 160
Uploads: 14
There is 3 known manuals on DropDownMenu:
WowAce from Xinhuan http://forums.wowace.com/showthread.php?t=15763
WowWiki http://www.wowwiki.com/Using_UIDropDownMenu
wowpedia http://wowpedia.org/Using_UIDropDownMenu

And thats newList:SetFrameStrata("FULLSCREEN_DIALOG") only gets triggered for multi level dropdowns or not?
It is called for every new list, i.e. for LIB_UIDROPDOWNMENU_MAXLEVELS at first (on addon load) and if you have more for others on Lib_UIDropDownMenu_CreateFrames.

Addig this line seems to be good for single level dropdowns, however any chance to dinamically set the strata based on the parent level + 1 strata sublevel or something? Aka the dropdown menu wont overlap higher strata level frames, like tooltips.
It is what Blizzard did. Tooltip strata higher than "FULLSCREEN_DIALOG" (see http://www.wowwiki.com/UITYPE_FrameStrata )
Last edited by another : 11-25-13 at 05:26 PM.
another is offline Report comment to moderator  
Reply With Quote
Old 11-25-13, 02:09 PM  
Resike
A Molten Giant
AddOn Author - Click to view AddOns

Forum posts: 527
File comments: 212
Uploads: 10
Originally Posted by another
Originally Posted by Resike
Using this solves the problem:

Lua Code:
  1. <Button name="Lib_UIDropDownListTemplate" hidden="true" frameStrata="FULLSCREEN_DIALOG" enableMouse="true" virtual="true">
Original
Code:
<Button name="UIDropDownListTemplate" hidden="true" frameStrata="DIALOG" enableMouse="true" virtual="true">
Modified
Code:
<Button name="Lib_UIDropDownListTemplate" hidden="true" frameStrata="DIALOG" enableMouse="true" virtual="true">
Both have DIALOG strata. And when you make
Code:
function Lib_ToggleDropDownMenu(level, value, dropDownFrame, anchorName, xOffset, yOffset, menuList, button, autoHideDelay)
	if ( not level ) then
		level = 1;
	end
	Lib_UIDropDownMenuDelegate:SetAttribute("createframes-level", level);
	Lib_UIDropDownMenuDelegate:SetAttribute("createframes-index", 0);
	Lib_UIDropDownMenuDelegate:SetAttribute("createframes", true);
that should call
Code:
function Lib_UIDropDownMenuDelegate_OnAttributeChanged (self, attribute, value)
	if ( attribute == "createframes" and value == true ) then
		Lib_UIDropDownMenu_CreateFrames(self:GetAttribute("createframes-level"), self:GetAttribute("createframes-index"));
and
Code:
function Lib_UIDropDownMenu_CreateFrames(level, index)

	while ( level > LIB_UIDROPDOWNMENU_MAXLEVELS ) do
		LIB_UIDROPDOWNMENU_MAXLEVELS = LIB_UIDROPDOWNMENU_MAXLEVELS + 1;
		local newList = CreateFrame("Button", "Lib_DropDownList"..LIB_UIDROPDOWNMENU_MAXLEVELS, nil, "Lib_UIDropDownListTemplate");
		newList:SetFrameStrata("FULLSCREEN_DIALOG");
so it should set FULLSCREEN_DIALOG strata. Am I miss something?
This is my dropdown script when i click on the menu button:

Lua Code:
  1. if _G["Lib_DropDownList1"]:IsVisible() and LIB_UIDROPDOWNMENU_OPEN_MENU == self:GetParent() then
  2.     Lib_CloseDropDownMenus()
  3. else
  4.     Lib_UIDropDownMenu_Initialize(self:GetParent(), PowaAurasOptions.DropDownMenu_Initialize)
  5.     Lib_ToggleDropDownMenu(nil, nil, self:GetParent())
  6.     PlaySound("igMainMenuOptionCheckBoxOn")
  7. end

And thats newList:SetFrameStrata("FULLSCREEN_DIALOG") only gets triggered for multi level dropdowns or not?

Edit:

Lua Code:
  1. local Lib_UIDropDownMenuDelegate = CreateFrame("Frame")
  2. for i = 1, LIB_UIDROPDOWNMENU_MAXLEVELS do
  3.     local listFrameName = "Lib_DropDownList"..i
  4.     local f = CreateFrame("Button", listFrameName, nil, "Lib_UIDropDownListTemplate")
  5.     f:SetFrameStrata("FULLSCREEN_DIALOG") -- THIS
  6.     f:SetID(i)
  7.     f:SetSize(180, 10)
  8.     local fontName, fontHeight, fontFlags = _G["Lib_DropDownList1Button1NormalText"]:GetFont()
  9.     LIB_UIDROPDOWNMENU_DEFAULT_TEXT_HEIGHT = fontHeight
  10.     for j = 1, LIB_UIDROPDOWNMENU_MAXBUTTONS do
  11.         local b = CreateFrame("Button", listFrameName.."Button"..j, f, "Lib_UIDropDownMenuButtonTemplate")
  12.         b:SetID(j)
  13.     end
  14. end

Addig this line seems to be good for single level dropdowns, however any chance to dinamically set the strata based on the parent level + 1 strata sublevel or something? Aka the dropdown menu wont overlap higher strata level frames, like tooltips.
Last edited by Resike : 11-25-13 at 02:27 PM.
Resike is offline Report comment to moderator  
Reply With Quote
Old 11-25-13, 01:48 PM  
another
A Murloc Raider
AddOn Author - Click to view AddOns

Forum posts: 7
File comments: 160
Uploads: 14
Originally Posted by Resike
Using this solves the problem:

Lua Code:
  1. <Button name="Lib_UIDropDownListTemplate" hidden="true" frameStrata="FULLSCREEN_DIALOG" enableMouse="true" virtual="true">
Original
Code:
<Button name="UIDropDownListTemplate" hidden="true" frameStrata="DIALOG" enableMouse="true" virtual="true">
Modified
Code:
<Button name="Lib_UIDropDownListTemplate" hidden="true" frameStrata="DIALOG" enableMouse="true" virtual="true">
Both have DIALOG strata. And when you make
Code:
function Lib_ToggleDropDownMenu(level, value, dropDownFrame, anchorName, xOffset, yOffset, menuList, button, autoHideDelay)
	if ( not level ) then
		level = 1;
	end
	Lib_UIDropDownMenuDelegate:SetAttribute("createframes-level", level);
	Lib_UIDropDownMenuDelegate:SetAttribute("createframes-index", 0);
	Lib_UIDropDownMenuDelegate:SetAttribute("createframes", true);
that should call
Code:
function Lib_UIDropDownMenuDelegate_OnAttributeChanged (self, attribute, value)
	if ( attribute == "createframes" and value == true ) then
		Lib_UIDropDownMenu_CreateFrames(self:GetAttribute("createframes-level"), self:GetAttribute("createframes-index"));
and
Code:
function Lib_UIDropDownMenu_CreateFrames(level, index)

	while ( level > LIB_UIDROPDOWNMENU_MAXLEVELS ) do
		LIB_UIDROPDOWNMENU_MAXLEVELS = LIB_UIDROPDOWNMENU_MAXLEVELS + 1;
		local newList = CreateFrame("Button", "Lib_DropDownList"..LIB_UIDROPDOWNMENU_MAXLEVELS, nil, "Lib_UIDropDownListTemplate");
		newList:SetFrameStrata("FULLSCREEN_DIALOG");
so it should set FULLSCREEN_DIALOG strata. Am I miss something?
another is offline Report comment to moderator  
Reply With Quote
Old 11-25-13, 10:56 AM  
Resike
A Molten Giant
AddOn Author - Click to view AddOns

Forum posts: 527
File comments: 212
Uploads: 10
Originally Posted by another
Originally Posted by Resike
I have an issues, for some reason my opened menus shows under my frames, makes them impossible to click.
I think if your addon less than DBM you can PM link to changed sources (to skip at least renaming part) and I'll look what is wrong. Are you using easymenu stuff or making menu yourself?

Eidt: Sounds like menu STRATA less than frame's strata. And if
Code:
function Lib_UIDropDownMenu_CreateFrames(level, index)

	while ( level > LIB_UIDROPDOWNMENU_MAXLEVELS ) do
		LIB_UIDROPDOWNMENU_MAXLEVELS = LIB_UIDROPDOWNMENU_MAXLEVELS + 1;
		local newList = CreateFrame("Button", "Lib_DropDownList"..LIB_UIDROPDOWNMENU_MAXLEVELS, nil, "Lib_UIDropDownListTemplate");
		newList:SetFrameStrata("FULLSCREEN_DIALOG");
called properly strata of your menu should be FULLSCREEN_DIALOG (highest)
Yeah i checked that first too.
No easymenus, i build it myself.

Lua Code:
  1. <Frame name = "PowaBarConfigFrame" movable = "true" parent = "UIParent" frameStrata = "DIALOG" toplevel = "true" hidden = "true" enableMouse = "true" enableKeyboard = "true">

If i set frameStrata = "HIGH", then its visible, if higher then not.

Only wondering because its working fine with the default templates with above "HIGH" strata too.

This is how it's looks like:



Edit:

Using this solves the problem:

Lua Code:
  1. <Button name="Lib_UIDropDownListTemplate" hidden="true" frameStrata="FULLSCREEN_DIALOG" enableMouse="true" virtual="true">
Last edited by Resike : 11-25-13 at 11:12 AM.
Resike is offline Report comment to moderator  
Reply With Quote
Old 11-25-13, 09:34 AM  
another
A Murloc Raider
AddOn Author - Click to view AddOns

Forum posts: 7
File comments: 160
Uploads: 14
Originally Posted by Resike
I have an issues, for some reason my opened menus shows under my frames, makes them impossible to click.
I think if your addon less than DBM you can PM link to changed sources (to skip at least renaming part) and I'll look what is wrong. Are you using easymenu stuff or making menu yourself?

Eidt: Sounds like menu STRATA less than frame's strata. And if
Code:
function Lib_UIDropDownMenu_CreateFrames(level, index)

	while ( level > LIB_UIDROPDOWNMENU_MAXLEVELS ) do
		LIB_UIDROPDOWNMENU_MAXLEVELS = LIB_UIDROPDOWNMENU_MAXLEVELS + 1;
		local newList = CreateFrame("Button", "Lib_DropDownList"..LIB_UIDROPDOWNMENU_MAXLEVELS, nil, "Lib_UIDropDownListTemplate");
		newList:SetFrameStrata("FULLSCREEN_DIALOG");
called properly strata of your menu should be FULLSCREEN_DIALOG (highest)
Last edited by another : 11-25-13 at 09:38 AM.
another is offline Report comment to moderator  
Reply With Quote
Old 11-25-13, 09:17 AM  
Resike
A Molten Giant
AddOn Author - Click to view AddOns

Forum posts: 527
File comments: 212
Uploads: 10
I have an issues, for some reason my opened menus shows under my frames, makes them impossible to click.
But despite of that, it's seems to working.
Last edited by Resike : 11-25-13 at 09:31 AM.
Resike is offline Report comment to moderator  
Reply With Quote
Old 11-25-13, 04:36 AM  
another
A Murloc Raider
AddOn Author - Click to view AddOns

Forum posts: 7
File comments: 160
Uploads: 14
Originally Posted by Resike
If this will work, i'll love you forever.

Edit: Still get taints.
Check all menu functions and constants renamed (even one left will screw everything). It fixed for me taints with TinyExtraBars and menus and there is no taints for me almost 1 year.

Well, another reason can be cascade taint between addons, when by using frame after frame taint spreads (some libraries using menus maybe etc).
Last edited by another : 11-25-13 at 04:53 AM.
another is offline Report comment to moderator  
Reply With Quote
Old 11-24-13, 04:03 PM  
Resike
A Molten Giant
AddOn Author - Click to view AddOns

Forum posts: 527
File comments: 212
Uploads: 10
If this will work, i'll love you forever.

Edit: Still get taints.
Last edited by Resike : 11-24-13 at 04:45 PM.
Resike is offline Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: