Originally Posted by Randactyl
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:
function AdvancedFilterGroup:AddSubfilter( name, icon, callback, dropdownCallbacks, dropdownWidth )
...
subfilter.dropdown = nil
--Dropdown will be created and made invisible here
if(dropdownCallbacks) then
dropdown = self:AddDropdownFilter( subfilter, dropdownCallbacks, dropdownWidth )
end
local button = WINDOW_MANAGER:CreateControl( subfilter:GetName() .. "Button", subfilter, CT_BUTTON )
button:SetAnchor(TOPLEFT, subfilter, TOPLEFT)
button:SetDimensions(ICON_SIZE, ICON_SIZE)
--I modified the handler callback function. The dropdown SetHidden(false) was moved before the
--check against "innerSelf == currentSelected", and was asked to only show if hidden
button:SetHandler("OnClicked", function(innerSelf)
if(not subfilter.isActive) then return end
--Moved up and enhanced by IsHidden() check here
if(subfilter.dropdown and subfilter.dropdown:IsHidden()) then
subfilter.dropdown:SetHidden(false)
end
if(innerSelf == currentSelected) then return end
self:ChangeLabel(tooltipSet[name])
MoveHighlightToMe(innerSelf)
OnClickedCallback(innerSelf)
end)
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.