View Single Post
02/16/15, 01:31 PM   #57
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
Originally Posted by merlight View Post
What's in a name? It is nor hand... I mean, does that combobox need to have a name?
This is ZO_ComboBox template used in dropdown widget:
XML Code:
  1. <GuiXml>
  2.     <Controls>
  3.         <Control name="ZO_ComboBox" mouseEnabled="true" virtual="true">
  4.             <Dimensions x="135" y="31" />
  5.             <OnInitialized>
  6.                 ZO_ComboBox:New(self)
  7.             </OnInitialized>
  8.  
  9.             <OnMouseUp>
  10.                 ZO_ComboBox_DropdownClicked(self)
  11.                 PlaySound(SOUNDS.COMBO_CLICK)
  12.             </OnMouseUp>
  13.  
  14.             <Controls>
  15.                 <Control name="$(parent)BG" inherits="ZO_InsetBackground"/>
  16.  
  17.                 <Label name="$(parent)SelectedItemText" font="ZoFontGame" color="INTERFACE_COLOR_TYPE_TEXT_COLORS:INTERFACE_TEXT_COLOR_SELECTED" wrapMode="ELLIPSIS" verticalAlignment="CENTER">
  18.                     <Anchor point="TOPLEFT" offsetX="8" />
  19.                     <Anchor point="BOTTOMRIGHT" offsetX="-20" />
  20.                 </Label>
  21.  
  22.                 <Button name="$(parent)OpenDropdown" inherits="ZO_DropdownButton">
  23.                     <Dimensions x="16" y="16" />
  24.                     <Anchor point="RIGHT" offsetX="-3" />
  25.  
  26.                     <OnClicked>
  27.                         ZO_ComboBox_DropdownClicked(self:GetParent())
  28.                     </OnClicked>
  29.                 </Button>
  30.             </Controls>
  31.         </Control>
  32.     </Controls>
  33. </GuiXml>
As this template has named controls which use $(parent), they needs named parent. Otherwise all named children will have duplicate names.
Of course, you can create combobox without template, but it will be much more complicated.
  Reply With Quote