Download
(33Kb)
Download
Updated: 05-25-17 01:14 AM
Compatibility:
Tomb of Sargeras (7.2.0)
Updated:05-25-17 01:14 AM
Created:11-24-13 01:19 PM
Downloads:10,237
Favorites:15
MD5:

NoTaint UIDropDownMenu  Popular! (More than 5000 hits)

Version: v7.2.0.24015-r3
by: another, arith

About
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


How to use it (for addon developer)
  • Add UIDropDownMenu.xml to your toc.
  • If your addon doesn't embed LibStub, you will need it.
  • Like ordinal code for UIDropDownMenu with "Lib_" instead.

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_SetInitializeFunction
  • Lib_UIDropDownMenu_RefreshDropDownSize
  • Lib_UIDropDownMenu_OnUpdate
  • Lib_UIDropDownMenu_StartCounting
  • Lib_UIDropDownMenu_StopCounting
  • Lib_UIDropDownMenu_CreateInfo
  • Lib_UIDropDownMenu_CreateFrames
  • Lib_UIDropDownMenu_AddSeparator
  • Lib_UIDropDownMenu_AddButton
  • Lib_UIDropDownMenu_AddSeparator
  • Lib_UIDropDownMenu_GetMaxButtonWidth
  • Lib_UIDropDownMenu_GetButtonWidth
  • 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_SetButtonNotClickable
  • Lib_UIDropDownMenu_SetButtonClickable
  • Lib_UIDropDownMenu_DisableDropDown
  • Lib_UIDropDownMenu_EnableDropDown
  • Lib_UIDropDownMenu_IsEnabled
  • Lib_UIDropDownMenu_GetValue

Source Repository

If you would like to access the source repository or would like to set external link to your addon project, please use below URL:

svn://svn.wowinterface.com/NoTaint_UIDropDownMenu_Update-1134/trunk

v7.2.0.24015-r3 (2017/05/25)
----------------------------
- Reverted LIB_UIDROPDOWNMENU_MAXBUTTONS back to 8
- Renamed ToC file name
- Added OptionalDeps: LibStub to ToC

v7.2.0.24015-r2 (2017/05/19)
----------------------------
- added version number to EasyMenu
- increased LIB_UIDROPDOWNMENU_MAXBUTTONS to 24
- renamed packaged folder name to !NoTaint_UIDropDownMenu
- No impact to addons which embedded this lib
- For users who installed this lib separately, please remove the old "NoTaint_UIDropDownMenu" folder

v7.2.0.24015 (2017/05/12)
-------------------------
- added UIDropDownMenu.xml;
- removed customized codes in creating buttons;
- removed customized codes in Lib_UIDropDownMenu_AddButton()
- added LibStub to set library's version

v7.2.0.23801-r3 (2017/04/27)
----------------------------
- fixed the loading order in ToC if this get installed separately.

v7.2.0.23801-r2 (2017/04/17)
----------------------------
- ToC update to support proper loading if user install this library separately; this is for WoW 7.2 release.

v7.2.0.23801 (2017/03/22)
--------------------------
- fixed the issue when dropdown menu has more than 1 level

v7.2.0.23789 (2017/03/22)
--------------------------
- lib update to sync with WoW 7.2.0.23789
- TOC update to support WoW 7.2.0

v7.1.0.22908.r7 (2016/12/26)
--------------------------
- fixes with listframe width

v7.1.0.22908.r6 (2016/12/26)
--------------------------
- some minor enhancement in logical operation:
Lib_UIDropDownMenu_AddButton - index's value; width and maxWidth's values

v7.1.0.22908 (2016/10/27)
--------------------------
- Toc update to support WoW 7.1.0
- Codes synch with 7.1.0.22908:
- Added function Lib_UIDropDownMenu_AddSeparator(info, level)

v1.2
----
Updated (thanks to Blazeflack). To use Lib_UIDropDownMenu_AddSeparator left text value empty like

Code:
local tabsSubmenu = {
	{ text = "Add new tab", func = AddNewTab, notCheckable = true, keepShownOnClick = false },
	{ notCheckable = true, notClickable = true },
	{ text = "Remove active tab", func = ConfirmRemoveTab, notCheckable = true, keepShownOnClick = false },
}
1.1
---
Fixed first two menu's strata.
Optional Files (1)
File Name
Version
Size
Author
Date
Type
7.2.0.23801
13kB
03-22-17 03:23 AM
Patch


Post A Reply Comment Options
Unread 09-04-17, 08:26 AM  
Resike
A Pyroguard Emberseer
AddOn Author - Click to view AddOns

Forum posts: 1290
File comments: 246
Uploads: 12
Originally Posted by another
Originally Posted by arith
Furthermore, I am planning to clone the NoTaint_UIDropDownMenu to another one and change the prefix Lib / LIB to other one. There are too many addons using the old lib, and I am receiving more and more complain saying my addons have problem. I feel it would be easier to start with a new lib.
I never thought workaround will live for so long. I found why, reported to Blizzard and proposed solution. Still - nothing.
It only took them 5 years to fix a secure group headers call that was breaking shit since Pandaria release, despite i reported it on a daily basis and yet i still had to pull some strings to finally get it fixed:
https://www.townlong-yak.com/framexm...s.lua/diff#672

And all it take is to add an extra _, argument.
Last edited by Resike : 09-04-17 at 08:31 AM.
Report comment to moderator  
Reply With Quote
Unread 09-04-17, 08:05 AM  
Resike
A Pyroguard Emberseer
AddOn Author - Click to view AddOns

Forum posts: 1290
File comments: 246
Uploads: 12
Originally Posted by arith
Originally Posted by Resike
This code here can broke not dropdowns with properly set SetID():

Lua Code:
  1. if (id == 1) then
  2.     L_UIDROPDOWNMENU_OPEN_MENU = nil;
  3. end
Means if someone use the built-in UIDropDownMenu codes, it will still result in same error?

What's the proposed action in your mind?
Maybe i was wrong, and i just had a fucked up dropdown. I hate these blizzard type dropdown building so much.
Report comment to moderator  
Reply With Quote
Unread 09-03-17, 07:00 AM  
arith
A Cyclonian
 
arith's Avatar
AddOn Author - Click to view AddOns

Forum posts: 45
File comments: 75
Uploads: 35
Originally Posted by Resike
This code here can broke not dropdowns with properly set SetID():

Lua Code:
  1. if (id == 1) then
  2.     L_UIDROPDOWNMENU_OPEN_MENU = nil;
  3. end
Means if someone use the built-in UIDropDownMenu codes, it will still result in same error?

What's the proposed action in your mind?
Report comment to moderator  
Reply With Quote
Unread 09-03-17, 02:21 AM  
another
A Deviate Faerie Dragon
AddOn Author - Click to view AddOns

Forum posts: 11
File comments: 187
Uploads: 12
Originally Posted by arith
Furthermore, I am planning to clone the NoTaint_UIDropDownMenu to another one and change the prefix Lib / LIB to other one. There are too many addons using the old lib, and I am receiving more and more complain saying my addons have problem. I feel it would be easier to start with a new lib.
I never thought workaround will live for so long. I found why, reported to Blizzard and proposed solution. Still - nothing.
Report comment to moderator  
Reply With Quote
Unread 09-02-17, 02:37 PM  
Resike
A Pyroguard Emberseer
AddOn Author - Click to view AddOns

Forum posts: 1290
File comments: 246
Uploads: 12
This code here can broke not dropdowns with properly set SetID():

Lua Code:
  1. if (id == 1) then
  2.     L_UIDROPDOWNMENU_OPEN_MENU = nil;
  3. end
Report comment to moderator  
Reply With Quote
Unread 05-24-17, 08:45 AM  
arith
A Cyclonian
 
arith's Avatar
AddOn Author - Click to view AddOns

Forum posts: 45
File comments: 75
Uploads: 35
LibUIDropDownMenu

Alright, just clone and created a new one: https://www.wowace.com/projects/libuidropdownmenu
and the one in WowInterface: http://www.wowinterface.com/download...pDownMenu.html
SVN source: https://repos.wowace.com/wow/libuidropdownmenu/trunk

I hope this will make things easier.
Last edited by arith : 05-24-17 at 10:10 PM.
Report comment to moderator  
Reply With Quote
Unread 05-23-17, 10:55 PM  
arith
A Cyclonian
 
arith's Avatar
AddOn Author - Click to view AddOns

Forum posts: 45
File comments: 75
Uploads: 35
Originally Posted by Resike
Originally Posted by arith
Originally Posted by Resike
Precreating 24 frames is not a good idea, first it's not neccessary, and it throws an error if you don't have a dropdown loaded with 24 items.
Hm... I did run several test but didn't see any errors. Could you post the error logs you encountered?
It iterates over the MAX buttons at line:77, and gives a nil error if it's not created.
I can't reproduce same error....
Anyway, I will revert it back to 8 in next release.
Furthermore, I am planning to clone the NoTaint_UIDropDownMenu to another one and change the prefix Lib / LIB to other one. There are too many addons using the old lib, and I am receiving more and more complain saying my addons have problem. I feel it would be easier to start with a new lib.
Report comment to moderator  
Reply With Quote
Unread 05-21-17, 12:51 PM  
Resike
A Pyroguard Emberseer
AddOn Author - Click to view AddOns

Forum posts: 1290
File comments: 246
Uploads: 12
Originally Posted by arith
Originally Posted by Resike
Precreating 24 frames is not a good idea, first it's not neccessary, and it throws an error if you don't have a dropdown loaded with 24 items.
Hm... I did run several test but didn't see any errors. Could you post the error logs you encountered?
It iterates over the MAX buttons at line:77, and gives a nil error if it's not created.
Report comment to moderator  
Reply With Quote
Unread 05-21-17, 09:04 AM  
arith
A Cyclonian
 
arith's Avatar
AddOn Author - Click to view AddOns

Forum posts: 45
File comments: 75
Uploads: 35
Originally Posted by Resike
Precreating 24 frames is not a good idea, first it's not neccessary, and it throws an error if you don't have a dropdown loaded with 24 items.
Hm... I did run several test but didn't see any errors. Could you post the error logs you encountered?
Report comment to moderator  
Reply With Quote
Unread 05-20-17, 01:49 PM  
Resike
A Pyroguard Emberseer
AddOn Author - Click to view AddOns

Forum posts: 1290
File comments: 246
Uploads: 12
Precreating 24 frames is not a good idea, first it's not neccessary, and it throws an error if you don't have a dropdown loaded with 24 items.
Report comment to moderator  
Reply With Quote
Unread 05-19-17, 12:23 PM  
arith
A Cyclonian
 
arith's Avatar
AddOn Author - Click to view AddOns

Forum posts: 45
File comments: 75
Uploads: 35
Originally Posted by ceylina
What I mean to say is that if an author follows your usage instructions and only links UIDropDownMenu.xml they will have issues trying to use this library without also linking libstub.

I have requested this in a few addons that are using outdated versions and they are hesitant to use the latest because following the included directions results in an error without explicitly adding libstub


I think this can be simply solved by adding the following in UIDropDownMenu.xml as the first script file

<Script file="LibStub\LibStub.lua"/>


Do by having the xml file look like this:

<Script file="LibStub\LibStub.lua"/>
<Script file="UIDropDownMenu.lua"/>
<Include file="UIDropDownMenuTemplates.xml"/>
<Script file="EasyMenu.lua"/>

It resolves the issue of making users add libstub explicitly in their TOC and instead they can continue to solely add UIDropDownMenu.xml and everything will be happy.
I know adding <Script file="LibStub\LibStub.lua"/> is one solution. But I cannot imagine any developer is not willing to update the outdated library, and also not quite willing to include LibStub.
Anyway, I have update the instruction first.

One idea came to my mind. Since the NoTaint_UIDropDown has been used in many addons but this lib was not maintained for a few years until I pick it up last year, I wonder if it worth to clone it, but then rename the functions and constants' prefix. For example, change Lib_UIDropDownXXXX to NLib_UIDropDownXXXX.
And for those developers who are more willing to keep their libs up to date, they might like to switch to the new one........
Report comment to moderator  
Reply With Quote
Unread 05-19-17, 12:02 PM  
ceylina
A Wyrmkin Dreamwalker

Forum posts: 50
File comments: 93
Uploads: 0
Originally Posted by arith
Originally Posted by ceylina
It seems the only way to get this to work with an addon now is to explicitly call libstub in your TOC file. For some reason libstub is not embedded in any include file in this library even though it is included in the folder.
I think it's quite often that most of the libs will only include the link of LibStub in toc, not in ther xml files. That being said, you will have to embed LibStub and link it in your ToC file.
I am not saying this make sense or make no sense, but I have seen most of the libs were doing so.

What I mean to say is that if an author follows your usage instructions and only links UIDropDownMenu.xml they will have issues trying to use this library without also linking libstub.

I have requested this in a few addons that are using outdated versions and they are hesitant to use the latest because following the included directions results in an error without explicitly adding libstub


I think this can be simply solved by adding the following in UIDropDownMenu.xml as the first script file

<Script file="LibStub\LibStub.lua"/>


Do by having the xml file look like this:

<Script file="LibStub\LibStub.lua"/>
<Script file="UIDropDownMenu.lua"/>
<Include file="UIDropDownMenuTemplates.xml"/>
<Script file="EasyMenu.lua"/>

It resolves the issue of making users add libstub explicitly in their TOC and instead they can continue to solely add UIDropDownMenu.xml and everything will be happy.
Report comment to moderator  
Reply With Quote
Unread 05-19-17, 10:12 AM  
arith
A Cyclonian
 
arith's Avatar
AddOn Author - Click to view AddOns

Forum posts: 45
File comments: 75
Uploads: 35
By the way,

I think I figured out the problem when user install the no-lib version of addons, and then install libs separately but then run into trouble with UIDropDownMenu.

I think the problem is the loading sequence.
My theory is, for example, the addon Atlas will be loaded earlier than NoTaint_UIDropDown. Then when a user use no-lib version of Atlas, it will run into problem.
An easy way to fix it would be to force NoTaint_UIDropDown to be loaded as earlier as possible, such as we add a "!" character as the folder's prefix.
Report comment to moderator  
Reply With Quote
Unread 05-19-17, 09:25 AM  
arith
A Cyclonian
 
arith's Avatar
AddOn Author - Click to view AddOns

Forum posts: 45
File comments: 75
Uploads: 35
Originally Posted by ceylina
It seems the only way to get this to work with an addon now is to explicitly call libstub in your TOC file. For some reason libstub is not embedded in any include file in this library even though it is included in the folder.
I think it's quite often that most of the libs will only include the link of LibStub in toc, not in ther xml files. That being said, you will have to embed LibStub and link it in your ToC file.
I am not saying this make sense or make no sense, but I have seen most of the libs were doing so.
Last edited by arith : 05-19-17 at 10:11 AM.
Report comment to moderator  
Reply With Quote
Unread 05-19-17, 06:55 AM  
ceylina
A Wyrmkin Dreamwalker

Forum posts: 50
File comments: 93
Uploads: 0
It seems the only way to get this to work with an addon now is to explicitly call libstub in your TOC file. For some reason libstub is not embedded in any include file in this library even though it is included in the folder.
Last edited by ceylina : 05-19-17 at 06:55 AM.
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: