ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Lua/XML Help (https://www.esoui.com/forums/forumdisplay.php?f=175)
-   -   ZO_ScrollableComboBox not modal for background controls (https://www.esoui.com/forums/showthread.php?t=7831)

@tinydog 06/02/18 10:17 AM

ZO_ScrollableComboBox not modal for background controls
 
2 Attachment(s)
Greetings. I just converted some ZO_ComboBox controls in my add-on to ZO_ScrollableComboBox, and I'm experiencing a bug. The dropdown is not blocking access to the controls in the background. Buttons behind the dropped-down box are still firing rollover events (button glow and tooltip), and they are still clickable - even though they are rendered underneath the dropdown box.

I tried playing with SetDrawLayer(), SetDrawLevel(), and SetDrawTier() on the containing control, the m_combobox, the DropdownDropdown, and the DropdownDropdownBG. It has no effect on the interactability of the background controls. I even made sure that the LibAddonMenu-2.0 library embedded in my add-on is the latest version.

At least one other user experienced this same exact problem with ZO_ScrollableComboBox, back in March 2017. There were no replies on his thread.

Here is my add-on UI with the offending ZO_ScrollableComboBox:


Here is a similar ZO_ScrollableComboBox in Dolgubon's Lazy Set Crafter, that is working properly - the background controls are blocked by the dropdown:


Here is my XML code for the dropdown template control:
Code:

<Control name="tccDropdownTemplate" virtual="true" inherits="ZO_ScrollableComboBox">
        <OnInitialized>
                ZO_ScrollableComboBox:New(self)
        </OnInitialized>
</Control>

Here is the LUA code to populate create and populate the dropdown:
Code:

local itemSetDropdown = tcc_GetOrCreateControlFromVirtual(rowControl, "tccItemSetDropdown", "tccDropdownTemplate")
itemSetDropdown:SetDimensions(250, 25)
itemSetDropdown:ClearAnchors()
itemSetDropdown:SetAnchor(TOPRIGHT, rowControl, TOPRIGHT, -10, 0)
itemSetDropdown.m_comboBox:SetSortsItems(false)
itemSetDropdown.m_comboBox:SetFont("tcc_ZoFontTooltipSubtitleSmall")
local dropdown = ZO_ComboBox_ObjectFromContainer(itemSetDropdown)
local noSet
for i, itemSet in ipairs(tcc.ItemSets) do
        if itemSet.ShortName == "None" then noSet = itemSet end
        local itemEntry = dropdown:CreateItemEntry(itemSet.LongName, function() tcc_SelectItemSet(itemSet) end)
        itemEntry.ItemSet = itemSet
        dropdown:AddItem(itemEntry)
end
dropdown:SetSelectedItem("None")

Here is the utility function I use to "get or create" a template-based control:
Code:

function tcc_GetOrCreateControlFromVirtual(parent, controlName, virtualControlName)
        local child
        if parent == nil then return nil end
        if parent:GetNumChildren() > 0 then
                for i = 1, parent:GetNumChildren() do
                        if parent:GetChild(i) ~= nil and parent:GetChild(i):GetName() == controlName then return parent:GetChild(i) end
                end
        end
        child = CreateControlFromVirtual(controlName, parent, virtualControlName)
        return child
end

Any insight that anyone could provide would be very much appreciated.

Dolgubon 06/02/18 01:03 PM

I had this exact same problem in the set crafter. As you've noticed it is fixed. Basically, you want to create the dropdown after anything it will be on top of.

@tinydog 06/02/18 03:47 PM

1 Attachment(s)
Quote:

Originally Posted by Dolgubon (Post 34921)
I had this exact same problem in the set crafter. As you've noticed it is fixed. Basically, you want to create the dropdown after anything it will be on top of.

You are a saint. Thank you! After moving the XML element containing the dropdowns to the bottom of its parent Controls element - after all other controls - and adjusting the subsequent controls' anchors so that they rendered in the right place, the dropdowns started behaving correctly. What a stupid bug.



All times are GMT -6. The time now is 03:48 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI