I have a button in XML with the following code:
Code:
<Frames>
<Button text="Sell" name="SellButton">
<Size>
<AbsDimension x="100" y="22" />
</Size>
<Layers>
<Layer level="BACKGROUND">
<FontString name="$parentSubText" inherits="GameFontNormalSmall" justifyH="LEFT"/>
</Layer>
</Layers>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="0" y="0" />
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>this:SetFrameLevel(this:GetFrameLevel() + 1);</OnLoad>
<OnClick>SOM:Sell()</OnClick>
</Scripts>
<NormalTexture file="Interface\Buttons\UI-Panel-Button-Up">
<TexCoords left="0" right="0.625" top="0" bottom="0.6875" />
</NormalTexture>
<PushedTexture file="Interface\Buttons\UI-Panel-Button-Down">
<TexCoords left="0" right="0.625" top="0" bottom="0.6875" />
</PushedTexture>
<DisabledTexture file="Interface\Buttons\UI-Panel-Button-Disabled">
<TexCoords left="0" right="0.625" top="0" bottom="0.6875" />
</DisabledTexture>
<HighlightTexture file="Interface\Buttons\UI-Panel-Button-Highlight" alphaMode="ADD">
<TexCoords left="0" right="0.625" top="0" bottom="0.6875" />
</HighlightTexture>
<ButtonText name="$parentText">
<FontHeight>
<AbsValue val="10" />
</FontHeight>
</ButtonText>
<NormalFont inherits="GameFontNormal" font="Fonts\FRIZQT__.TTF">
<FontHeight>
<AbsValue val="12" />
</FontHeight>
<Color r="1" g="0.8196079" b="0" />
<Shadow>
<Color r="0" g="0" b="0" />
<Offset>
<AbsDimension x="1" y="-1" />
</Offset>
</Shadow>
</NormalFont>
<HighlightFont inherits="GameFontHighlight" font="Fonts\FRIZQT__.TTF">
<FontHeight>
<AbsValue val="12" />
</FontHeight>
<Color r="1" g="1" b="1" />
<Shadow>
<Color r="0" g="0" b="0" />
<Offset>
<AbsDimension x="1" y="-1" />
</Offset>
</Shadow>
</HighlightFont>
<DisabledFont inherits="GameFontDisable" font="Fonts\FRIZQT__.TTF">
<FontHeight>
<AbsValue val="12" />
</FontHeight>
<Color r="0.4980392" g="0.4980392" b="0.4980392" />
<Shadow>
<Color r="0" g="0" b="0" />
<Offset>
<AbsDimension x="1" y="-1" />
</Offset>
</Shadow>
</DisabledFont>
<PushedTextOffset x="0" y="0" />
</Button>
</Frames>
When I first load the button it all goes well:
Button shows in the correct layer, its clickable and it calls the function when I click on it.
If I close the merchant window and reopened any other time, I find this:
Button is in the same layer, but merchant frame is now 5 layers above! So I cant see nor click on the button.
For showing/hiding the button I use the functions show() & hide().
Any clue on what can I do to solve this?