I'm trying to convert this part of the XML file to Lua but so far no joy.
Lua Code:
<Control name="$(parent)_ComboBoxZone" resizeToFitDescendents="true" mouseEnabled="true">
<Anchor point="TOPRIGHT" offsetX="-8" offsetY="15"/>
<OnInitialized>
ZO_ComboBox:New(self)
</OnInitialized>
<OnMouseUp>
ZO_ComboBox_DropdownClicked(self)
</OnMouseUp>
<Controls>
<Button name="$(parent)OpenDropdown" inherits="ZO_DropdownButton">
<Dimensions x="16" y="16" />
<Anchor point="TOPRIGHT"/>
<OnClicked>
ZO_ComboBox_DropdownClicked(self:GetParent())
</OnClicked>
</Button>
<Label name="$(parent)SelectedItemText">
<Anchor point="RIGHT" relativeTo="$(parent)OpenDropdown" relativePoint="LEFT" offsetX="-3" />
</Label>
</Controls>
</Control>
I thought that it would covert to something like this but no joy.
Lua Code:
tlw.ZoneList = WindowMgr:CreateControl(nil,tlw,CT_CONTROL)
tlw.ZoneList:SetAnchor(TOPRIGHT,tlw,TOPRIGHT,-8,15)
tlw.ZoneList:SetHandler("OnInitialized",function(self)
ZO_ComboBox:New(self)
end)
tlw.ZoneList:SetHandler("OnMouseUp",function(self)
ZO_ComboBox_DropdownClicked(self)
end)
tlw.ZoneList.Button = WindowMgr:CreateControlFromVirtual(nil,tlw,"ZO_DropdownButton")
tlw.ZoneList.Button:SetDimensions(16,16)
tlw.ZoneList.Button:SetAnchor(TOPRIGHT,tlw.ZoneList,TOPRIGHT,0,0)
tlw.ZoneList.Button:SetHandler("OnClicked",function(self)
ZO_ComboBox_DropdownClicked(self:GetParent())
end)
tlw.ZoneList.Caption = WindowMgr:CreateControl(nil,tlw,CT_LABEL)
tlw.ZoneList.Caption:SetFont("ZoFontGame")
tlw.ZoneList.Caption:SetAnchor(RIGHT,tlw.ZoneList.Button,LEFT,0,0)
tlw.ZoneList.DropDown = ZO_ComboBox_ObjectFromContainer( tlw.ZoneList )
tlw.ZoneList.DropDown:SetSelectedItemFont( 'ZoFontWinH2' ) -------> Line 458
tlw.ZoneList.DropDown:SetDropdownFont( 'ZoFontHeader2' )
tlw.ZoneList.DropDown:SetSpacing( 8 )
tlw.ZoneList.DropDown:SetSelectedItem( tlw.ZoneList.DropDown.SelectedItem )
The screenshots attached show the display at the moment along with the error that is being reported. If someone, perhaps Pawkette who created the initial addon that I found this code in could explain if there was a way that they knew of coding it in Lua.
The one without the error is with the who UI code inside the XML, the second one is with everything except the combo boxes which don't seem to want to work.