Thread Tools Display Modes
06/02/18, 10:17 AM   #1
@tinydog
 
@tinydog's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2015
Posts: 9
Question ZO_ScrollableComboBox not modal for background controls

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.
Attached Thumbnails
Click image for larger version

Name:	TCC Scrollable Dropdown Not Modal.jpg
Views:	822
Size:	170.0 KB
ID:	1012  Click image for larger version

Name:	Dolgubon Dropdown Working.jpg
Views:	820
Size:	130.1 KB
ID:	1013  

Last edited by @tinydog : 06/02/18 at 10:26 AM. Reason: Added code.
  Reply With Quote
06/02/18, 01:03 PM   #2
Dolgubon
 
Dolgubon's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2016
Posts: 408
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.
  Reply With Quote
06/02/18, 03:47 PM   #3
@tinydog
 
@tinydog's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2015
Posts: 9
Thumbs up

Originally Posted by Dolgubon View Post
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.

Attached Thumbnails
Click image for larger version

Name:	TCC Scrollable Dropdown Fixed.jpg
Views:	700
Size:	30.2 KB
ID:	1014  
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » ZO_ScrollableComboBox not modal for background controls

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