View Single Post
03/15/19, 02:36 PM   #16
KLISK
 
KLISK's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2018
Posts: 21
Originally Posted by Letho
Virtual controls DO NOT call <OnInitialized> though, each child control of a virtual has to call the <OnInitialized> functions seperately. That is very strange...
Here is an example of adding a new control to the pool and hiding the existing one.
<OnInitialized> is called once when an object is created, any global function or Lua code can be placed here.

Xml Code:
  1. <GuiXml>
  2.     <Controls>
  3.         <Control name="IG_PlayerInventorySlot" inherits="ZO_PlayerInventorySlot" virtual="true">
  4.             <Controls>
  5.                 <Label name="$(parent)Name" hidden="true" override="true" />
  6.                 <Backdrop name="$(parent)Backdrop" inherits="ZO_CenterlessBackdrop" tier="LOW" layer="BACKGROUND" hidden="false" override="true">
  7.                     <Edge file="InventoryGrid/Textures/border3.dds" edgeFileWidth="128" edgeFileHeight="16" />
  8.                     <Center file="InventoryGrid/Textures/bg3.dds" />
  9.                     <OnInitialized>
  10.                         self:SetCenterColor(1, 1, 1, 1)
  11.                         self:SetEdgeColor(1, 1, 1, 1)
  12.                     </OnInitialized>
  13.                 </Backdrop>
  14.             </Controls>
  15.         </Control>
  16.     </Controls>
  17. </GuiXml>
  Reply With Quote