Skip to content

Instantly share code, notes, and snippets.

@Meorawr
Last active December 12, 2022 15:37
Show Gist options
  • Save Meorawr/cb878a33f2191cedb56790d1e9091c4e to your computer and use it in GitHub Desktop.
Save Meorawr/cb878a33f2191cedb56790d1e9091c4e to your computer and use it in GitHub Desktop.
Tab System Demo
MyAddon_TabSystemDemoFrameMixin = {}
function MyAddon_TabSystemDemoFrameMixin:OnLoad()
TabSystemOwnerMixin.OnLoad(self)
self:SetTabSystem(self.TabSystem)
self.tabIndexPage1 = self:AddNamedTab("Page 1", self.TabPage1)
self.tabIndexPage2 = self:AddNamedTab("Page 2 (with truncated text)", self.TabPage2)
self.tabIndexPage3 = self:AddNamedTab("Page 3", self.TabPage3)
self:SetTab(self.tabIndexPage2)
end
<Ui>
<Include file="MyAddon_TabSystemDemoFrame.lua"/>
<Frame name="MyAddon_TabSystemDemoFrame" inherits="TabSystemOwnerTemplate" mixin="MyAddon_TabSystemDemoFrameMixin">
<Size x="300" y="300"/>
<Anchors>
<Anchor point="CENTER"/>
</Anchors>
<Frames>
<Frame parentKey="TabSystem" inherits="TabSystemTemplate">
<KeyValues>
<KeyValue key="minTabWidth" value="100" type="number"/>
<KeyValue key="tabTemplate" value="TabSystemButtonTemplate" type="string"/>
</KeyValues>
<Anchors>
<Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT"/>
</Anchors>
</Frame>
<Frame parentKey="TabPage1" setAllPoints="true">
<Layers>
<Layer level="BACKGROUND">
<Texture setAllPoints="true">
<Color r="1"/>
</Texture>
</Layer>
</Layers>
</Frame>
<Frame parentKey="TabPage2" setAllPoints="true">
<Layers>
<Layer level="BACKGROUND">
<Texture setAllPoints="true">
<Color g="1"/>
</Texture>
</Layer>
</Layers>
</Frame>
<Frame parentKey="TabPage3" setAllPoints="true">
<Layers>
<Layer level="BACKGROUND">
<Texture setAllPoints="true">
<Color b="1"/>
</Texture>
</Layer>
</Layers>
</Frame>
</Frames>
<Scripts>
<OnLoad method="OnLoad"/>
</Scripts>
</Frame>
</Ui>
@Meorawr
Copy link
Author

Meorawr commented Dec 12, 2022

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment