View Single Post
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