Thread Tools Display Modes
04/28/14, 09:37 PM   #1
Wykkyd
Are you Wykkyd Gaming?
 
Wykkyd's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 107
Any luck with scrolling DDLs?

I'm trying to get this code (via Xrystal and Seerah in another thread) to scroll an emote list. Basically replacing the home-grown DDL I generated for this a few versions back. The problem is the popup, or drop down, uses ZO_ComboBox and that doesn't provide scrolling support, height or width settings.

Code:
UIDDL = function( name, parent, data, selected, callBack )
    local combo = WINDOW_MANAGER:CreateControlFromVirtual( parent:GetName()..name, parent , "ZO_StatsDropdownRow" )
    combo:SetAnchor(CENTER)
    combo:GetNamedChild("Dropdown"):SetWidth(100)
 
    combo.selected = combo.name
    combo.selected:SetFont("ZoFontGame")
 
    combo.dropdown = combo.dropdown
    combo.dropdown:SetFont("ZoFontGame")
    if selected then combo.dropdown:SetSelectedItem(selected) end
 
    combo.dropdown.OnSelect = function(self,value)
	callBack( value )
    end
 
    for i = 1,#data do
        local entry = combo.dropdown:CreateItemEntry(data[i],combo.dropdown.OnSelect)
        combo.dropdown:AddItem(entry)
    end
    return combo
end
So either one of you fine people have a workaround for this or I'm going to have to jimmy the click event to display my own popup instead, which I really don't want to do. Thanks in advance folks
  Reply With Quote
04/29/14, 10:52 AM   #2
Iyanga
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 183
Even the UI cheats and uses a button in a label to display/hide a scroll control.
  Reply With Quote
04/30/14, 11:04 AM   #3
Wykkyd
Are you Wykkyd Gaming?
 
Wykkyd's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 107
I'll post some code later but here's what I ended up doing last night:

Create the base object using CreateControlFromVirtual on ZO_StatsDropdownRow

Wrapped an if-else around the "for i = 1,#data do" block as before, based on a new parameter: scrollSupport (bool)

If scrollSupport was requested, I don't do the standard data insert block. Instead I override the "OnClicked" event of the "DropdownOpenDropdown" named child, which is the arrow in the dropdown box. With that I:

1 - Call an "item" Func 5 times
2 - Position those items one on top of another, below the dropdown
3 - Attach a vertical slider to the inner right edge of the 1st item, overlaying all of them

The "item" Func creates a Backdrop with a Label on top.
Each one is "static" and doesn't change, hide, move, etc.
Each one carries it's own handling of OnMouseWheel, OnMouseEnter, OnMouseExit, OnMouseDown (click doesn't work unless I built a button, but I didn't want the extra overhead).

To handle the scrolling I trigger movement based on OnMouseWheel over an "item" label, or the slider. For each movement I find the top-level data element that SHOULD be displayed and set it's text to item1, then cascade that to items 2 through 5 sequentially down the data's table, basically just changing the SetText of each label so that the objects never change/move, just the displayed value.

The OnMouseDown of each item cascades to the outer Dropdown's callBackFunc() function, which calls the external Callback to return the value that was clicked... all based on item's GetText().

And the entire scrolling drop-down thing is singular, and simply re-parents whenever a different DDL wants use of it.

I'll post code later when I get home. I'm very happy with the results. It basically results in 12 controls that repurpose themselves, show & layer appropriately and handle scrolling of even thousands of data items instantly with no performance hit.

This will be making its way through all of my addons very shortly.
  Reply With Quote
04/30/14, 12:37 PM   #4
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 648
This sounds like the FauxScrollFrame in WoW.
  Reply With Quote
04/30/14, 12:39 PM   #5
Stormknight
 
Stormknight's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 128
I like the sound of it Wykkyd, sounds really nice.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Any luck with scrolling DDLs?


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