Quantcast
NoTaint_UIDropDownMenu conflicts with MoveAnything - WoWInterface
Thread Tools Display Modes
05-10-17, 08:09 PM   #1
Ketho
A Molten Giant
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 928
NoTaint_UIDropDownMenu conflicts with MoveAnything

I recently updated WardrobeSort but one of the older versions had a conflict with MoveAnything and Z-Perl
...at least the (bad) way I tried to grab the text from the dropdown did not work with the version / shared globals from MoveAnything
How we are supposed to embed NoTaint_UIDropDownMenu? (WoWI/Curse)
Since it's not using LibStub and is not on a repository

This makes me wonder what version of this library MoveAnything is usingElvUI embeds a slightly modified version of this library but it doesn't give any of the same problems when loaded

Would it otherwise be better to use MSA-DropDownMenu?

Last edited by Ketho : 05-10-17 at 09:06 PM.
  Reply With Quote
05-11-17, 01:06 AM   #2
arith
A Cyclonian
 
arith's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 44
MoveEverything is not using the "NoTaint_UIDropDownMenu" published on WowInterface or CurseForge. This may not be very accurate, but based on one of the comment Resike posted, I would guess he got one of of the early version and then maintained his own revision within MoveEverything. That probably is because the original "author" (who created the project) did not keep updating it.

"NoTaint_UIDropDownMenu" is meant to provide a replacement for all UIDropDown related functions, or says it is to provide an alternative, kind of a clone version with different function name. So it was not packaged or created with a common lib we saw likes to use LibStub to call NewLibrary function.

To use NoTaint_UIDropDownMenu, 1st thing is to include it in ToC or one of your library XML with the following order:
  • UIDropDownMenuTemplates.xml
  • UIDropDownMenu.lua

Then, the usage would be exactly the same like the way you use the Blizzard's UIDropDownMenu.

A few examples:
1.
local info = Lib_UIDropDownMenu_CreateInfo()
This is one of the suggested way that you get a clean info to be used for the menu setting. The function call should has "Lib_" as the prefix.

2.
Lib_UIDropDownMenu_AddButton(info)
Once your menu setting is done, you use this function to add the button.

3.
LIB_UIDROPDOWNMENU_MENU_VALUE
If you need to use the constant, you need "LIB_" as the prefix.

You can refer to this old thread on WowAce: https://forums.wowace.com/showthread.php?t=15763
And also refer to the usage explanation here.

If you would like to see some more examples or codes, maybe one of my addon could help: https://wow.curseforge.com/projects/...cking-enhanced

I seldom enable MoveEverything while in WoW, but I can guess there could be some conflit with NoTaint_UIDropDown, since both use the same function prefix.

The one I maintained is trying to sync with Blizzard's version, so where there is any new function added (such as UIDropDownMenu_AddSeparator() ), I will do the same.

Hope this helps.

Last edited by arith : 05-11-17 at 02:09 AM.
  Reply With Quote
05-11-17, 02:41 AM   #3
arith
A Cyclonian
 
arith's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 44
I spent a few time reading to the issue posted in your addon project, and did some test with MoveEverything and some of my addons which also use NoTaint_UIDropDown (such as Accountant Classic, or World Map Tracking Enhanced), I found something weird.
If I disable all addons, but only enable WardrobeSort and Accountant Classic (which we use exactly the same version of NoTaint_UIDropDown), and when I visit the transmogrifer and the UI pop-up, clicking on the Sort By menu, I can see the menu items from Accountant Classic is also showing there.
I am not sure where is going wrong, but this is the first time I saw such issue. I will look into the codes in my addons although I am not sure if there is anything wrong there.
  Reply With Quote
05-11-17, 03:48 AM   #4
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,289
I do actually use an older version of the notaint dropdowns (my cleaned up version), since i didn't know there was an updated one. Using the two different libs together at the same time could cause some issues for sure, since they share global functions.

I'll try this new library since it might have some issues by it's own, so it needs some testing.
The old versions works fine 100%, but only if it's not used together with the new one.
  Reply With Quote
05-11-17, 03:51 AM   #5
Ketho
A Molten Giant
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 928
Originally Posted by arith View Post
I spent a few time reading to the issue posted in your addon project, and did some test with MoveEverything and some of my addons which also use NoTaint_UIDropDown (such as Accountant Classic, or World Map Tracking Enhanced), I found something weird.
If I disable all addons, but only enable WardrobeSort and Accountant Classic (which we use exactly the same version of NoTaint_UIDropDown), and when I visit the transmogrifer and the UI pop-up, clicking on the Sort By menu, I can see the menu items from Accountant Classic is also showing there.

That sounds weird... I tried to test this but I couldn't reproduce it yet

https://gfycat.com/AbsoluteAdeptCurassow

-----

About the issue, I was badly grabbing the text from the dropdown,
I tried to index the Text field but it apparently doesn't exist when MoveAnything's version is also loaded
Lua Code:
  1. local dropdown = CreateFrame("Frame", "TestDropDown", UIParent, "Lib_UIDropDownMenuTemplate")
  2. Lib_UIDropDownMenu_SetText(dropdown, "Hello World")
  3. print(Lib_UIDropDownMenu_GetText(dropdown))
  4. print(dropdown.Text:GetText())
Code:
Message: ..\AddOns\WardrobeSort\WardrobeSort.lua line 4:
   attempt to index field 'Text' (a nil value)

Last edited by Ketho : 05-11-17 at 04:36 AM. Reason: forgot about Lib_UIDropDownMenu_GetText
  Reply With Quote
05-11-17, 03:52 AM   #6
Ketho
A Molten Giant
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 928
Originally Posted by Resike View Post
I do actually use an older version of the notaint dropdowns (my cleaned up version), since i didn't know there was an updated one. Using the two different libs together at the same time could cause some issues for sure, since they share global functions.

Thanks for clarifying, Resike

Last edited by Ketho : 05-11-17 at 04:05 AM.
  Reply With Quote
05-11-17, 04:10 AM   #7
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,289
Originally Posted by Ketho View Post
Thanks for clarifying Resike
Tha main issue on your part is that, since (alphabetically) Z-Perl loads last, and overrides all the global funcions (within an evil laugh) so you think you are working with the new lib functions but you really not.

The problems:
If any addon will update to a newer version of the lib it will always cause troubles since the global namespace.
The lib designed to work as a standalone lib, however it looks dumb if you just add another folder to your addon, and not incude it inside. And other addons would blindly owerwrite this lib to their versions.
If you think the users will properly install/update and use this lib as a standalone nolib, thats not gonna work either.

Mainly thats why i went and any of my new addons i'll use my own dropdown functions with no global access and whatsoever. However currently i still have 3 old addons which depending on this lib.

Now i wonder how the hell did nobody reported this issue for me for 5 months?

Last edited by Resike : 05-11-17 at 04:34 AM.
  Reply With Quote
05-11-17, 04:19 AM   #8
arith
A Cyclonian
 
arith's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 44
for the issue that Accountant Classic's menu will be showing in WardrobeSort, I can do some enhancement to see if the problem will be gone.
But like Resike said, even with the NoTaint_UIDropDown which I revised, still need some more test as I can 100% sure it should work just fine.

For your information, I did add some enhancement in the function Lib_UIDropDownMenu_AddButton():
1.
old codes:
Lua Code:
  1. ....
  2.     local listFrame = _G["DropDownList"..level];
  3.     local index = listFrame and (listFrame.numButtons + 1) or 1;
  4.     local width;
new codes:
Lua Code:
  1. ....
  2.     local index;
  3.     local listFrame = _G["Lib_DropDownList"..level];
  4.     if (listFrame and listFrame.numButtons) then
  5.         index = listFrame.numButtons + 1;
  6.     else
  7.         index = 1;
  8.     end
  9.     local width;

2.
old codes:
Lua Code:
  1. ....
  2.     width = max(UIDropDownMenu_GetButtonWidth(button), info.minWidth or 0);
  3.     --Set maximum button width
  4.     if ( width > listFrame.maxWidth ) then
  5.         listFrame.maxWidth = width;
  6.     end
new codes:
Lua Code:
  1. ....
  2.     width = max(Lib_UIDropDownMenu_GetButtonWidth(button), info.minWidth or 0);
  3.     --Set maximum button width
  4.     if ( listFrame.maxWidth and width > listFrame.maxWidth ) then
  5.         listFrame.maxWidth = width;
  6.     end
  Reply With Quote
05-11-17, 04:43 AM   #9
Ketho
A Molten Giant
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 928
Looking forward to the update. It's nice to not die from taint =)
  Reply With Quote
05-11-17, 05:09 AM   #10
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,289
Originally Posted by Ketho View Post
Looking forward to the update. It's nice to not die from taint =)
Do you still need any help how to use the lib itself, or everything works now if you disable other addons with older notaint lib?

I did some testing the the new dropdown lib seems okay atm. Will push an update with it for my addons.

On sidenote, currently the biggest addon which still taints the dropdowns is OmniCC (which could blame some other addons for the taint), however only in it's config function so if you disable OmniCC Config you are golden. I'll talk with Tuller to fix this tho.
  Reply With Quote
05-11-17, 05:25 AM   #11
Ketho
A Molten Giant
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 928
Originally Posted by Resike View Post
Do you still need any help how to use the lib itself, or everything works now if you disable other addons with older notaint lib?

It looks like everything is working fine now after that commit even with MoveAnything / Z-Perl loaded

But I originally didn't use the lib properly anyway
  Reply With Quote
05-11-17, 06:10 AM   #12
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,289
Originally Posted by arith View Post
I spent a few time reading to the issue posted in your addon project, and did some test with MoveEverything and some of my addons which also use NoTaint_UIDropDown (such as Accountant Classic, or World Map Tracking Enhanced), I found something weird.
If I disable all addons, but only enable WardrobeSort and Accountant Classic (which we use exactly the same version of NoTaint_UIDropDown), and when I visit the transmogrifer and the UI pop-up, clicking on the Sort By menu, I can see the menu items from Accountant Classic is also showing there.
I am not sure where is going wrong, but this is the first time I saw such issue. I will look into the codes in my addons although I am not sure if there is anything wrong there.
This could mean that one of the addons is not using some calls properly using the Lib_ and the standard Blizzard functions at the same time.

If you call ToggleDropDownMenu and Lib_ToggleDropDownMenu at the same time that would populate the menu twice, which could cause some elements to stuck there even if you open another dropdown. Because the Blizzard funcitons might still think the dropdown is open, while the lib thinks the dropdown is closed.

Last edited by Resike : 05-11-17 at 06:12 AM.
  Reply With Quote
05-11-17, 09:29 AM   #13
arith
A Cyclonian
 
arith's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 44
Tested with WardrobeSort + Accountant Classic or WardrobeSort + Atlas, somehow the menu item from other addon will be showing in WardrobeSort's menu.
See the screenshot:

My solution for both of my addons is to move the Lib_UIDropDownMenu_Initialize() from the addon or the frame's OnLoad to OnShow. Doesn't make much sense to me though...
  Reply With Quote
05-11-17, 11:09 AM   #14
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,289
I can also reproduce it it seems like if you open dropdown with more then 8 elements then open a smaller one while the bigger dropdown is opened, and if they use the same template and two dropdown is populated by two different addons (you still wih me? :P), then it will only clear the info for the first 8 elements, and show any older info from element 9 to the size of the previous dropdown.

I'm not sure where is the issue tho.

Last edited by Resike : 05-11-17 at 11:24 AM.
  Reply With Quote
05-11-17, 04:54 PM   #15
Ketho
A Molten Giant
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 928
Originally Posted by Ketho View Post
That sounds weird... I tried to test this but I couldn't reproduce it yet

https://gfycat.com/AbsoluteAdeptCurassow
Only now I realize I was looking at the Ace3 dropdowns instead of the Accountant Classic NoTaint_UIDropDownMenu dropdowns /facepalm

Originally Posted by arith View Post
Tested with WardrobeSort + Accountant Classic or WardrobeSort + Atlas, somehow the menu item from other addon will be showing in WardrobeSort's menu.
I still have no idea why that was happening even after reading your posts or where the issue lies. Hopefully it's not because WardrobeSort (LoadOnDemand) is initializing the dropdowns on WardrobeCollectionFrame.ItemsCollectionFrame:HookScript("OnShow", func) or something
  Reply With Quote
05-12-17, 12:02 AM   #16
arith
A Cyclonian
 
arith's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 44
Originally Posted by Ketho View Post
I still have no idea why that was happening even after reading your posts or where the issue lies. Hopefully it's not because WardrobeSort (LoadOnDemand) is initializing the dropdowns on WardrobeCollectionFrame.ItemsCollectionFrame:HookScript("OnShow", func) or something
Not sure if it's related to the hootscript, but I also suspect it could related to the customized codes below:
Lua Code:
  1. for i = 1, LIB_UIDROPDOWNMENU_MAXLEVELS do
  2.     local listFrameName = "Lib_DropDownList"..i;   
  3.     local f = CreateFrame("Button", listFrameName, nil, "Lib_UIDropDownListTemplate");
  4.     f:SetID(i);
  5.     f:SetSize(180, 10);
  6.     f:SetFrameStrata("FULLSCREEN_DIALOG");
  7.     local fontName, fontHeight, fontFlags = _G["Lib_DropDownList1Button1NormalText"]:GetFont();
  8.     LIB_UIDROPDOWNMENU_DEFAULT_TEXT_HEIGHT = fontHeight;
  9.     for j = 1, LIB_UIDROPDOWNMENU_MAXBUTTONS do
  10.         local b = CreateFrame("Button", listFrameName.."Button"..j, f, "Lib_UIDropDownMenuButtonTemplate");
  11.         b:SetID(j);
  12.     end
  13. end

This was added in the very early version of the NoTaint_DropDownMenu.
  Reply With Quote
05-12-17, 01:43 AM   #17
arith
A Cyclonian
 
arith's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 44
Guys, could you try the latest revision on SVN Repository here?
svn://svn.wowinterface.com/NoTaint_UIDropDownMenu_Update-1134/trunk

I think by adding UIDropDownMenu.xml back might be a good idea.
With revision 16, you will need to load UIDropDownMenu.xml instead of loading UIDropDownMenuTemplates.xml and UIDropDownMenu.lua.
I also remove the customized codes, tried tested in my addons Accountant Classic, Atlas, and also tested in WardrobeSort, everything looks fine.

Though this didn't resolve the menu item from Accountant Classic or Atlas showing in WardrobeSort's dropdown.
I look into the UIDropDownMenu.lua and UIDropDownMenuTemplates.xml deeper, the default codes assume the max button to be 8 and will do some initialization. The default codes also can handle the situation when menu item is greater than 8.
It looks a little bit confused as the constant LIB_UIDROPDOWNMENU_MAXBUTTONS was set to 8, but it also will grow when you have more than 8 menu items to be showed.

I think maybe it's a design issue in my addons that I should not do the menu initialization in OnLoad event, instead, should do it in OnShow? I can't say it for sure as I can see Blizzard's EncounterJournal also do the menu initialization in OnLoad event.
Anyway, I will change my codes in my addons to manage the menu initialization in OnShow as it looks to resolve the conflict issue with WardrobeSort.

BTW, Titan is also using NoTaint_UIDropDown, I will inform the author to update the library.
  Reply With Quote
05-12-17, 03:30 AM   #18
HonorGoG
An Aku'mai Servant
 
HonorGoG's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2008
Posts: 32
Originally Posted by arith View Post
BTW, Titan is also using NoTaint_UIDropDown, I will inform the author to update the library.
Thanks for the heads-up Arith. I'll get the updated lib into Titan Panel ASAP and push out an update.
  Reply With Quote
05-12-17, 05:13 AM   #19
arith
A Cyclonian
 
arith's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 44
Just commit revision 17 to add LibStub and introduce LibStub:NewLibrary to set version number.
Since LibStub has been used, this will need to be loaded after LibStub.
Please test it and let me know if any issue.
  Reply With Quote
05-12-17, 01:37 PM   #20
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,289
Originally Posted by arith View Post
Just commit revision 17 to add LibStub and introduce LibStub:NewLibrary to set version number.
Since LibStub has been used, this will need to be loaded after LibStub.
Please test it and let me know if any issue.
I think the issue is that every addon has it's own functions and sometimes the library calls a function from on addon's file, and sometimes from an another addons file, which could create mismatch numbers even in global variables. If every addon updates to a version which won't let the lib load twice or load an older versions the issue will be gone.

You can eliminate the problem by putting this hack into the Lib_ToggleDropDownMenu funcitons, however you gonna need to put this into every addon's function:

Lua Code:
  1. for i = listFrame.numButtons + 1, 1000 do
  2.     local button = _G["Lib_DropDownList"..level.."Button"..i]
  3.     if button then
  4.         button:Hide()
  5.     else
  6.         break
  7.     end
  8. end

Also this only deals with the visible issues the global mismatch between addons still gonna reamain. The total solution is that the versioning system which will only allow one instance of the lib and it's functions.

Last edited by Resike : 05-12-17 at 01:57 PM.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » NoTaint_UIDropDownMenu conflicts with MoveAnything

Thread Tools
Display Modes

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