View Single Post
12/03/14, 07:25 PM   #66
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 5,044
Originally Posted by Randactyl View Post
And yeah, I've been wrestling with that Houdini dropdown for a while but no one has really reported it.
The dropdownbox seems only to hide if you:
I've tested the following at a vendor's sell panel:

1. Click on any of the inventory buttons, e.g. "Weapons" (the "All" subfilter button of AdvancedFilters will be automatically selected) except the "All" inventory button
2. Click on the "All" inventory button
3. Click again on the SAME inventory button you have been at 1. (in my example "Weapons")

or

1. Click on any of the inventory buttons, e.g. "Weapons" (the "All" subfilter button of AdvancedFilters will be automatically selected) except the "All" inventory button
2. Close the vendor
3. Talk to the same vendor again -> The sell panel will be opened automatically at the last inventory button you have chosen at 1. (in my example "Weapons")

Checking your source code the dropdown is created and made invisible.
As someone clicks the button of a subfilter the dropdown will change the content and will be made visible.
But only if the button is not the last pressed button from before and some other stuff applies.

I modified your function AdvancedFilterGroup:AddSubfilter a bit:
Lua Code:
  1. function AdvancedFilterGroup:AddSubfilter( name, icon, callback, dropdownCallbacks, dropdownWidth )
  2. ...
  3.  
  4.     subfilter.dropdown = nil
  5.  
  6. --Dropdown will be created and made invisible here
  7.     if(dropdownCallbacks) then
  8.         dropdown = self:AddDropdownFilter( subfilter, dropdownCallbacks, dropdownWidth )
  9.     end
  10.  
  11.     local button = WINDOW_MANAGER:CreateControl( subfilter:GetName() .. "Button", subfilter, CT_BUTTON )
  12.     button:SetAnchor(TOPLEFT, subfilter, TOPLEFT)
  13.     button:SetDimensions(ICON_SIZE, ICON_SIZE)
  14.  
  15. --I modified the handler callback function. The dropdown SetHidden(false) was moved before the
  16. --check against "innerSelf == currentSelected", and was asked to only show if hidden
  17.     button:SetHandler("OnClicked", function(innerSelf)
  18.             if(not subfilter.isActive) then return end
  19. --Moved up and enhanced by IsHidden() check here           
  20. if(subfilter.dropdown and subfilter.dropdown:IsHidden()) then
  21.                 subfilter.dropdown:SetHidden(false)
  22.             end
  23.             if(innerSelf == currentSelected) then return end
  24.             self:ChangeLabel(tooltipSet[name])
  25.             MoveHighlightToMe(innerSelf)
  26.             OnClickedCallback(innerSelf)
  27.         end)
  28.     button.filterCallback = callback

It seems to work now. The dropdownbox is shown properly for the subfilters in both scenarios i've tested above. But it was not tested everywhere!
Maybe it helps you find the bug.

Last edited by Baertram : 12/03/14 at 07:51 PM.
  Reply With Quote