View Single Post
04/07/14, 11:04 PM   #19
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 648
Okay, so... ZO_Options_Dropdown is the template used for the settings menus. This includes a base frame, the options text on the left and a dropdown on the right. The actual dropdown object does inherit from ZO_ComboBox.

SO. I went through the API and all the stuff I have *ahem* and wrote this up from scratch, based on the dropdown to select your guild in the guild window. I booted up the launcher to log in to check it, but I see there's a patch. And it's downloading at about 60 kb/s at the moment. So... untested. It's my bedtime.

Lua Code:
  1. local wm = WINDOW_MANAGER
  2. local choices = {"apple", "banana", "cherry"}
  3.  
  4. local myFrame = wm:CreateTopLevelWindow("myFrameForXrystal")
  5.     myFrame:SetAnchor(CENTER)
  6.     myFrame:SetDimensions(200, 50)
  7. local dropdownContainer = wm:CreateControl("myFrameForXrystalDropdown", myFrame, CT_CONTROL)
  8.     dropdownContainer:SetHandler("OnMouseUp", ZO_ComboBox_DropdownClicked)
  9.     dropdownContainer:SetAnchor(CENTER)
  10. local selected = wm:CreateControl("myFrameForXrystalDropdownSelected", dropdownContainer, CT_LABEL)
  11.     selected:SetAnchor(TOPLEFT)
  12.     selected:SetColor(GetInterfaceColor(INTERFACE_COLOR_TYPE_TEXT_COLORS, INTERFACE_TEXT_COLOR_SELECTED)
  13. local open = wm:CreateControlFromVirtual("myFrameForXrystalDropdownOpen", dropdownContainer, "ZO_DropdownButton")
  14.     open:SetDimensions(16,16)
  15.     open:SetAnchor(LEFT, selected, RIGHT, 3, 0)
  16. local dropdown = ZO_ComboBox:New(dropdownContainer)
  17.  
  18. local function OnItemSelect(entryText, entry)
  19.     d(entryText, entry)
  20. end
  21.  
  22. for i=1,#choices do
  23.     local entry = dropdown:CreateItemEntry(choices[i], OnItemSelect)  --this really just creates a table with {name = choices[i], callback = OnItemSelect} - you may be able to skip this step...
  24.     dropdown:AddItem(entry)  --again, entry is just a table with the above args stored in it
  25. end

Patch is at 10%. Guess I'll leave that running overnight... Hope this works!
  Reply With Quote