View Single Post
04/08/14, 05:43 AM   #20
Xrystal
caritas omnia vincit
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 369
Thanks Seerah, I'll let you know. I went to bed before I even saw this myself. Couldn't keep my eyes open any longer rofl.

edit:

Nada, I even added a backdrop to make things easier to see but cannot see the dropdown arrow anywhere on the screen. But it also isn't triggering any errors.

I tried putting it in a function and display debug text to see if it was getting in there and the whole addon wasn't apparently working ... maybe it doesn't like my name of ZO_ComboBoxTest as an addon name but it is okay with ZO_ObjectTest rofl.


edit2:
Erm, note to self and make sure the files listed in the txt file are EXACTLY the same as the ones used and not missing a letter ... testing again


edit3:
It displays but clicking the dropdown arrow does squat. Oh wait there is something missing in your code that was in Pawkette's let me see what it is.

edit4:
Yes the following code in Pawkette was missing from the lua
Lua Code:
  1. <Button name="$(parent)OpenDropdown" inherits="ZO_DropdownButton">
  2.                             <Dimensions x="16" y="16" />
  3.                             <Anchor point="TOPRIGHT"/>
  4.                             <OnClicked>
  5.                                 ZO_ComboBox_DropdownClicked(self:GetParent())
  6.                             </OnClicked>
  7.                         </Button>
So added the OnClicked handler into the mix to see if that worked ..
Lua Code:
  1. local open = wm:CreateControlFromVirtual("myFrameForXrystalDropdownOpen", dropdownContainer, "ZO_DropdownButton")
  2. open:SetDimensions(16,16)
  3. open:SetAnchor(LEFT, selected, RIGHT, 3, 0)
  4. open:SetHandler("OnClicked",function() ZO_ComboBox_DropdownClicked(self:GetParent()) end)

et voila .. the same problem I was getting in my code ..

error on line 20 which is the new SetHandler line I added :
Lua Code:
  1. user:/AddOns/ZO_ComboBoxTest/ZO_ComboBoxTest.lua:20: attempt to index a nil value
  2. stack traceback:
  3.     user:/AddOns/ZO_ComboBoxTest/ZO_ComboBoxTest.lua:20: in function '(anonymous)'

So the question seems to be why does it make it work being in the xml but errors out when it isn't

edit 5:
self didn't exist .. changed that line so it says :
open:SetHandler("OnClicked",function(self) ZO_ComboBox_DropdownClicked(self:GetParent()) end)

And it worked .. apart from setting the selected text .. another slight tweak to the code ...
First picture is this part working.

edit 6:
Looks like the following code block from Pawkette's code needs to be somewhere in your example but cannot see where it fits:
Lua Code:
  1. local dropDown = ZO_ComboBox_ObjectFromContainer( comboBox )
  2. dropDown:SetSelectedItemFont( 'ZoFontGameLarge' )
  3. dropDown:SetDropdownFont( 'ZoFontGame' )
  4. dropDown:SetSpacing( 8 )
  5. dropDown:SetSelectedItem( dropDown.SelectedItem )
  6. --dropDown.Button = self:GetNamedChild(name.."OpenDropdown")

Looking at the Button reference I tried it (minus the ObjectFromContainer line) in with your dropdown code and your selected code but both triggered the following error where the line mentioned is the SetSelectedItemFont line inferring it never got created ..

edit 7:
There is also this element in the CT_CONTROL combox Box xml code that seems to not be in your code block and I believe this is the code that allows the text side of the control to resize based on the selected text ... which is what the extra code mentioned above relates to.

Lua Code:
  1. resizeToFitDescendents="true"

Still no joy figuring this out, but hopefully your erm .. extra info will identify where this needs to go to work properly.

And if I haven't already said it, thanks again Seerah.
Attached Thumbnails
Click image for larger version

Name:	Screenshot_20140408_134251.jpg
Views:	768
Size:	581.8 KB
ID:	106  

Last edited by Xrystal : 04/08/14 at 07:23 AM.
  Reply With Quote