Thread Tools Display Modes
09-16-22, 05:50 PM   #1
Sharpedge
A Cyclonian
 
Sharpedge's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2022
Posts: 42
Need some help on XML to LUA

I have been working on an older addon from 2017. I have everything working except for one thing. The panel/frame is in XML. I have made a panel with LUA. But its empty. I can pull up the addon with the slash command and all the buttons are there, but no panel around it. In another words I have a blank panel (moveable, exit button) and another with all the addon buttons. Both are on my screen. Can anyone guide me in the right direction?

Code:
<Ui xmlns="http://www.blizzard.com/wow/ui" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Frame name="LocationMessageView" enableMouse="true" movable="true">
    <Scripts>
      <OnLoad> 
        <![CDATA[
        self:RegisterForDrag("LeftButton")
        LocationMessageView:Hide()
        ]]>;
		LocationMessageView:RegisterEvent("ZONE_CHANGED_NEW_AREA");
      </OnLoad>
      <OnDragStart>self:StartMoving();</OnDragStart>
      <OnDragStop>self:StopMovingOrSizing();</OnDragStop>
      <OnShow>
      </OnShow>
	   <OnEvent>LocationMessageController:on_zone_changed(event)</OnEvent>
    </Scripts>

    <Size>
      <AbsDimension x="139" y="170" />
    </Size>
    <Anchors>
      <Anchor point="CENTER" relativeTo="UIParent">
        <Offset>
          <AbsDimension x="0" y="0" />
        </Offset>
      </Anchor>
    </Anchors>
    <TitleRegion setAllPoints="true" />
    <Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true">
      <BackgroundInsets>
        <AbsInset left="11" right="12" top="12" bottom="11" />
      </BackgroundInsets>
      <TileSize>
        <AbsValue val="32" />
      </TileSize>
      <EdgeSize>
        <AbsValue val="32" />
      </EdgeSize>
    </Backdrop>
    <Frames>
      <Button name="AllClear" text="All Clear">
        <!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508884-59c2-4f83-ae10-27aaad48391b" />-->
        <Size>
          <AbsDimension x="93" y="27" />
        </Size>
        <Anchors>
          <Anchor point="TOPLEFT">
            <Offset>
              <AbsDimension x="22" y="-59" />
            </Offset>
          </Anchor>
        </Anchors>
        <Scripts>
          <OnClick>location_message_controller:on_all_clear_button_pressed()</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">
          <Anchors>
            <Anchor point="CENTER">
              <Offset>
                <AbsDimension x="0" y="1" />
              </Offset>
            </Anchor>
          </Anchors>
          <FontHeight>
            <AbsValue val="10" />
          </FontHeight>
        </ButtonText>
        <NormalFont style="GameFontNormal" />
        <HighlightFont style="GameFontHighlight" />
        <DisabledFont style="GameFontDisable" />
      </Button>
		<Button name="Incoming" text="Incoming">
			<!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508884-59c2-4f83-ae10-27aaad48391b" />-->
			<Size>
				<AbsDimension x="93" y="27" />
			</Size>
			<Anchors>
				<Anchor point="TOPLEFT">
					<Offset>
						<AbsDimension x="22" y="-94" />
					</Offset>
				</Anchor>
			</Anchors>
			<Scripts>
				<OnClick>location_message_controller:on_incoming_button_pressed()</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">
				<Anchors>
					<Anchor point="CENTER">
						<Offset>
							<AbsDimension x="0" y="1" />
						</Offset>
					</Anchor>
				</Anchors>
				<FontHeight>
					<AbsValue val="10" />
				</FontHeight>
			</ButtonText>
			<NormalFont style="GameFontNormal" />
			<HighlightFont style="GameFontHighlight" />
			<DisabledFont style="GameFontDisable" />
		</Button>
		<Button name="SendMore" text="Send More">
			<!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508884-59c2-4f83-ae10-27aaad48391b" />-->
			<Size>
				<AbsDimension x="93" y="27" />
			</Size>
			<Anchors>
				<Anchor point="TOPLEFT">
					<Offset>
						<AbsDimension x="22" y="-129" />
					</Offset>
				</Anchor>
			</Anchors>
			<Scripts>
				<OnClick>location_message_controller:on_sendmore_button_pressed()</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">
				<Anchors>
					<Anchor point="CENTER">
						<Offset>
							<AbsDimension x="0" y="1" />
						</Offset>
					</Anchor>
				</Anchors>
				<FontHeight>
					<AbsValue val="10" />
				</FontHeight>
			</ButtonText>
			<NormalFont style="GameFontNormal" />
			<HighlightFont style="GameFontHighlight" />
			<DisabledFont style="GameFontDisable" />
		</Button>
		<Button name="Incoming1" text="1">
			<!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508884-59c2-4f83-ae10-27aaad48391b" />-->
			<Size>
				<AbsDimension x="15" y="29" />
			</Size>
			<Anchors>
				<Anchor point="TOPLEFT">
					<Offset>
						<AbsDimension x="22" y="-24" />
					</Offset>
				</Anchor>
			</Anchors>
			<Scripts>
				<OnClick>location_message_controller:on_incoming_button1_pressed()</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">
				<Anchors>
					<Anchor point="CENTER">
						<Offset>
							<AbsDimension x="0" y="1" />
						</Offset>
					</Anchor>
				</Anchors>
				<FontHeight>
					<AbsValue val="10" />
				</FontHeight>
			</ButtonText>
			<NormalFont style="GameFontNormal" />
			<HighlightFont style="GameFontHighlight" />
			<DisabledFont style="GameFontDisable" />
		</Button>
		<Button name="Incoming2" text="2">
			<!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508884-59c2-4f83-ae10-27aaad48391b" />-->
			<Size>
				<AbsDimension x="15" y="29" />
			</Size>
			<Anchors>
				<Anchor point="TOPLEFT">
					<Offset>
						<AbsDimension x="37" y="-24" />
					</Offset>
				</Anchor>
			</Anchors>
			<Scripts>
				<OnClick>location_message_controller:on_incoming_button2_pressed()</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">
				<Anchors>
					<Anchor point="CENTER">
						<Offset>
							<AbsDimension x="0" y="1" />
						</Offset>
					</Anchor>
				</Anchors>
				<FontHeight>
					<AbsValue val="10" />
				</FontHeight>
			</ButtonText>
			<NormalFont style="GameFontNormal" />
			<HighlightFont style="GameFontHighlight" />
			<DisabledFont style="GameFontDisable" />
		</Button>
		<Button name="Incoming3" text="3">
			<!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508884-59c2-4f83-ae10-27aaad48391b" />-->
			<Size>
				<AbsDimension x="15" y="29" />
			</Size>
			<Anchors>
				<Anchor point="TOPLEFT">
					<Offset>
						<AbsDimension x="52" y="-24" />
					</Offset>
				</Anchor>
			</Anchors>
			<Scripts>
				<OnClick>location_message_controller:on_incoming_button3_pressed()</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">
				<Anchors>
					<Anchor point="CENTER">
						<Offset>
							<AbsDimension x="0" y="1" />
						</Offset>
					</Anchor>
				</Anchors>
				<FontHeight>
					<AbsValue val="10" />
				</FontHeight>
			</ButtonText>
			<NormalFont style="GameFontNormal" />
			<HighlightFont style="GameFontHighlight" />
			<DisabledFont style="GameFontDisable" />
		</Button>
		<Button name="Incoming4" text="4">
			<!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508884-59c2-4f83-ae10-27aaad48391b" />-->
			<Size>
				<AbsDimension x="15" y="29" />
			</Size>
			<Anchors>
				<Anchor point="TOPLEFT">
					<Offset>
						<AbsDimension x="67" y="-24" />
					</Offset>
				</Anchor>
			</Anchors>
			<Scripts>
				<OnClick>location_message_controller:on_incoming_button4_pressed()</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">
				<Anchors>
					<Anchor point="CENTER">
						<Offset>
							<AbsDimension x="0" y="1" />
						</Offset>
					</Anchor>
				</Anchors>
				<FontHeight>
					<AbsValue val="10" />
				</FontHeight>
			</ButtonText>
			<NormalFont style="GameFontNormal" />
			<HighlightFont style="GameFontHighlight" />
			<DisabledFont style="GameFontDisable" />
		</Button>
		<Button name="Incoming5" text="Zerg">
			<!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508884-59c2-4f83-ae10-27aaad48391b" />-->
			<Size>
				<AbsDimension x="35" y="29" />
			</Size>
			<Anchors>
				<Anchor point="TOPLEFT">
					<Offset>
						<AbsDimension x="82" y="-24" />
					</Offset>
				</Anchor>
			</Anchors>
			<Scripts>
				<OnClick>location_message_controller:on_incoming_button5_pressed()</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">
				<Anchors>
					<Anchor point="CENTER">
						<Offset>
							<AbsDimension x="0" y="1" />
						</Offset>
					</Anchor>
				</Anchors>
				<FontHeight>
					<AbsValue val="10" />
				</FontHeight>
			</ButtonText>
			<NormalFont style="GameFontNormal" />
			<HighlightFont style="GameFontHighlight" />
			<DisabledFont style="GameFontDisable" />
		</Button>
	</Frames>
  </Frame>
</Ui>
Code:
local Incoming = CreateFrame("Frame", nil, PARENT_FRAME, BackdropTemplateMixin and "BackdropTemplate");
Incoming:SetBackdrop({
      bgFile="Interface\\DialogFrame\\UI-DialogBox-Background", 
      edgeFile="Interface\\DialogFrame\\UI-DialogBox-Border", 
      tile=1, tileSize=32, edgeSize=32, 
      insets={left=11, right=12, top=12, bottom=11}
})
Incoming:SetWidth(139)
Incoming:SetHeight(190)
Incoming:SetPoint("CENTER",UIParent)
Incoming:EnableMouse(true)
Incoming:SetMovable(true)
Incoming:RegisterForDrag("LeftButton")
Incoming:SetScript("OnDragStart", function(self) self:StartMoving() end)
Incoming:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end)
Incoming:SetFrameStrata("FULLSCREEN_DIALOG")

local button = CreateFrame("button","IncomingButton", Incoming, "UIPanelButtonTemplate")
button:SetHeight(24)
button:SetWidth(60)
button:SetPoint("BOTTOM", Incoming, "BOTTOM", 0, 10)
button:SetText("Close")
button:SetScript("OnClick", function(self)  self:GetParent():Hide() end)
  Reply With Quote
09-16-22, 07:42 PM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
It looks like you already have a grasp on how to create UI objects and parent them. If you need a reference, there's WoWPedia's Widget API page.

The most time-consuming part of the conversion is turning XML's tree structure into a flat linear format.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
09-16-22, 08:16 PM   #3
Sharpedge
A Cyclonian
 
Sharpedge's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2022
Posts: 42
Originally Posted by SDPhantom View Post
It looks like you already have a grasp on how to create UI objects and parent them. If you need a reference, there's WoWPedia's Widget API page.

The most time-consuming part of the conversion is turning XML's tree structure into a flat linear format.
Yeah, thats where I'm getting confused. Thank you for the link, I will check it out.
  Reply With Quote
09-16-22, 08:17 PM   #4
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
Also, try changing the parenting from
Lua Code:
  1. local Incoming = CreateFrame("Frame", nil, PARENT_FRAME, BackdropTemplateMixin and "BackdropTemplate");
to

Lua Code:
  1. local Incoming = CreateFrame("Frame", nil, LocationMessageView, BackdropTemplateMixin and "BackdropTemplate");
Unless you have PARENT_FRAME assigned as something somewhere, it is nil.

The name of your XML frame (LocationMessageView) will be added to the global table and, assuming your XML file/frame loads first, you can use that as the parent in your .lua frame. This is done with the names of all frames.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
09-16-22, 08:23 PM   #5
Sharpedge
A Cyclonian
 
Sharpedge's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2022
Posts: 42
Originally Posted by Fizzlemizz View Post
Also, try changing the parenting from
Lua Code:
  1. local Incoming = CreateFrame("Frame", nil, PARENT_FRAME, BackdropTemplateMixin and "BackdropTemplate");
to

Lua Code:
  1. local Incoming = CreateFrame("Frame", nil, LocationMessageView, BackdropTemplateMixin and "BackdropTemplate");
Unless you have PARENT_FRAME assigned as something somewhere, it is nil.

The name of your XML frame (LocationMessageView) will be added to the global table and, assuming your XML file/frame loads first, you can use that as the parent in your .lua frame. This is done with the names of all frames.
Just tried it and got the same results.
  Reply With Quote
09-16-22, 08:32 PM   #6
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
You seem to want the XML to be parented to the .lua frame so probably more like:


Lua Code:
  1. local Incoming = CreateFrame("Frame", "SharpedgeFrame", UIParent, BackdropTemplateMixin and "BackdropTemplate");
  2. Incoming:SetBackdrop({
  3.       bgFile="Interface\\DialogFrame\\UI-DialogBox-Background",
  4.       edgeFile="Interface\\DialogFrame\\UI-DialogBox-Border",
  5.       tile=1, tileSize=32, edgeSize=32,
  6.       insets={left=11, right=12, top=12, bottom=11}
  7. })
  8. Incoming:Hide()
  9. LocationMessageView:Show()
  10. LocationMessageView:SetParent(Incoming)
  11. LocationMessageView:ClearAllPoints()
  12. LocationMessageView:SetPoint("TOP")
  13. Incoming:SetWidth(139)
  14. Incoming:SetHeight(190)
  15. Incoming:SetPoint("CENTER",UIParent)
  16. Incoming:EnableMouse(true)
  17. Incoming:SetMovable(true)
  18. Incoming:RegisterForDrag("LeftButton")
  19. Incoming:SetScript("OnDragStart", function(self) self:StartMoving() end)
  20. Incoming:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end)
  21. Incoming:SetFrameStrata("FULLSCREEN_DIALOG")
  22.  
  23. local button = CreateFrame("button","IncomingButton", Incoming, "UIPanelButtonTemplate")
  24. button:SetHeight(24)
  25. button:SetWidth(60)
  26. button:SetPoint("BOTTOM", Incoming, "BOTTOM", 0, 10)
  27. button:SetText("Close")
  28. button:SetScript("OnClick", function(self)  self:GetParent():Hide() end)

and you would show/hide SharpedgeFrame in your slash command

I'm assuming the load order of the files based on their order in your OP.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 09-16-22 at 08:36 PM.
  Reply With Quote
09-16-22, 08:44 PM   #7
Sharpedge
A Cyclonian
 
Sharpedge's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2022
Posts: 42
Originally Posted by Fizzlemizz View Post
You seem to want the XML to be parented to the .lua frame so probably more like:


Lua Code:
  1. local Incoming = CreateFrame("Frame", "SharpedgeFrame", UIParent, BackdropTemplateMixin and "BackdropTemplate");
  2. Incoming:SetBackdrop({
  3.       bgFile="Interface\\DialogFrame\\UI-DialogBox-Background",
  4.       edgeFile="Interface\\DialogFrame\\UI-DialogBox-Border",
  5.       tile=1, tileSize=32, edgeSize=32,
  6.       insets={left=11, right=12, top=12, bottom=11}
  7. })
  8. Incoming:Hide()
  9. LocationMessageView:Show()
  10. LocationMessageView:SetParent(Incoming)
  11. LocationMessageView:ClearAllPoints()
  12. LocationMessageView:SetPoint("TOP")
  13. Incoming:SetWidth(139)
  14. Incoming:SetHeight(190)
  15. Incoming:SetPoint("CENTER",UIParent)
  16. Incoming:EnableMouse(true)
  17. Incoming:SetMovable(true)
  18. Incoming:RegisterForDrag("LeftButton")
  19. Incoming:SetScript("OnDragStart", function(self) self:StartMoving() end)
  20. Incoming:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end)
  21. Incoming:SetFrameStrata("FULLSCREEN_DIALOG")
  22.  
  23. local button = CreateFrame("button","IncomingButton", Incoming, "UIPanelButtonTemplate")
  24. button:SetHeight(24)
  25. button:SetWidth(60)
  26. button:SetPoint("BOTTOM", Incoming, "BOTTOM", 0, 10)
  27. button:SetText("Close")
  28. button:SetScript("OnClick", function(self)  self:GetParent():Hide() end)

and you would show/hide SharpedgeFrame in your slash command

I'm assuming the load order of the files based on their order in your OP.
Its throwing an error: attempt to index global 'LocationMessageView; (a nil value)
  Reply With Quote
09-16-22, 08:57 PM   #8
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
The XML is being loaded after the .lua. You don't say if your .lua file is being made part of the addon or a separate addon so I will assume separate and this should work in either case unless the original addon is Load-On-Demand.

Lua Code:
  1. local Incoming = CreateFrame("Frame", "SharpedgeFrame", UIParent, BackdropTemplateMixin and "BackdropTemplate");
  2. Incoming:SetBackdrop({
  3.       bgFile="Interface\\DialogFrame\\UI-DialogBox-Background",
  4.       edgeFile="Interface\\DialogFrame\\UI-DialogBox-Border",
  5.       tile=1, tileSize=32, edgeSize=32,
  6.       insets={left=11, right=12, top=12, bottom=11}
  7. })
  8. Incoming:Hide()
  9. Incoming:SetWidth(139)
  10. Incoming:SetHeight(190)
  11. Incoming:SetPoint("CENTER",UIParent)
  12. Incoming:EnableMouse(true)
  13. Incoming:SetMovable(true)
  14. Incoming:RegisterForDrag("LeftButton")
  15. Incoming:SetScript("OnDragStart", function(self) self:StartMoving() end)
  16. Incoming:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end)
  17. Incoming:SetFrameStrata("FULLSCREEN_DIALOG")
  18.  
  19. local button = CreateFrame("button","IncomingButton", Incoming, "UIPanelButtonTemplate")
  20. button:SetHeight(24)
  21. button:SetWidth(60)
  22. button:SetPoint("BOTTOM", Incoming, "BOTTOM", 0, 10)
  23. button:SetText("Close")
  24. button:SetScript("OnClick", function(self)  self:GetParent():Hide() end)
  25.  
  26. Incoming:RegisterEvent("PLAYER_LOGIN")
  27. Incoming:SetScript("OnEvent", function(self, event, ...)
  28.     LocationMessageView:Show()
  29.     LocationMessageView:SetParent(self)
  30.     LocationMessageView:ClearAllPoints()
  31.     LocationMessageView:SetPoint("TOP")
  32.     LocationMessageView:SetMovable(false)
  33.     LocationMessageView:EnableMouse(false)
  34. end)
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
09-16-22, 09:11 PM   #9
Sharpedge
A Cyclonian
 
Sharpedge's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2022
Posts: 42
Yes its enabled on boot. But now there is nothing on my screen. Even if I use the slash /inc it just gives the options for slash in the chat window.

I really do appreciate you helping me on this. I'm still learning.
  Reply With Quote
09-16-22, 09:26 PM   #10
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
Is /inc showing/hiding SharpedgeFrame or whatever name you gave to the "Incoming" frame?

If the slash command is in the same .lua file as Incoming (but the code is after Incoming has been created) you can use Incoming instead.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
09-16-22, 09:31 PM   #11
Sharpedge
A Cyclonian
 
Sharpedge's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2022
Posts: 42
Originally Posted by Fizzlemizz View Post
Is /inc showing/hiding SharpedgeFrame or whatever name you gave to the "Incoming" frame?

If the slash command is in the same .lua file as Incoming (but the code is after Incoming has been created) you can use Incoming instead.
On the lua you provided I changed SharpedgeFrame to IncomingFrame and get the same results. If I'm understanding your question right.
  Reply With Quote
09-16-22, 09:35 PM   #12
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
Can you post all the .lua including the slash command?
Are the .lua and .xml in separate addons or included in the same .toc?
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
09-16-22, 09:40 PM   #13
Sharpedge
A Cyclonian
 
Sharpedge's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2022
Posts: 42
Originally Posted by Fizzlemizz View Post
Can you post all the .lua including the slash command?
Are the .lua and .xml in separate addons or included in the same .toc?
The XML is in its own folder. I tried having it called through the toc but get an
"attempt to index global" when I click a button. But all im getting on my screen is all the clickable buttons for the addon. There is is no exit button. Would you like a link to the addon itself?
  Reply With Quote
09-16-22, 09:44 PM   #14
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
Originally Posted by Sharpedge View Post
Would you like a link to the addon itself?
It would help.

The global space where the frame names are stored is shared by all addons and the entire Blizzard UI so a name of "IncomingFrame" being fairly simple, might be being overwittedn by something else.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
09-16-22, 09:47 PM   #15
Sharpedge
A Cyclonian
 
Sharpedge's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2022
Posts: 42
Originally Posted by Fizzlemizz View Post
It would help.

The global space where the frame names are stored is shared by all addons and the entire Blizzard UI so a name of "IncomingFrame" being fairly simple, might be being overwittedn by something else.
https://www.curseforge.com/wow/addon...lianceincoming
  Reply With Quote
09-16-22, 10:17 PM   #16
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
You're essentially taking control of another addon so you can't entirely rely on it's slash command(s). For this you will need to provide one of your own (in this case /sinc)

The .toc for your addon (the ## Dependencies: means the Incomming addon will load first.)
Lua Code:
  1. ## Interface:  90205
  2. ## Title: Sharpedge Inc
  3. ## Author: Sharpedge
  4. ## Version: 1.0.0
  5. ## Dependencies: Incoming
  6.  
  7. Sharpedge.lua

The Sharpedge.lua (or whatever you've called it)
Lua Code:
  1. local Incoming = CreateFrame("Frame", "SharpedgeIncommingFrame", UIParent, BackdropTemplateMixin and "BackdropTemplate");
  2. Incoming:SetBackdrop({
  3.       bgFile="Interface\\DialogFrame\\UI-DialogBox-Background",
  4.       edgeFile="Interface\\DialogFrame\\UI-DialogBox-Border",
  5.       tile=1, tileSize=32, edgeSize=32,
  6.       insets={left=11, right=12, top=12, bottom=11}
  7. })
  8. Incoming:Hide()
  9. LocationMessageView:SetParent(Incoming)
  10. LocationMessageView:Show()
  11. LocationMessageView:ClearAllPoints()
  12. LocationMessageView:SetPoint("TOP")
  13. LocationMessageView:SetMovable(false)
  14. LocationMessageView:EnableMouse(false)Incoming:SetWidth(139)
  15. Incoming:SetHeight(190)
  16. Incoming:SetPoint("CENTER",UIParent)
  17. Incoming:EnableMouse(true)
  18. Incoming:SetMovable(true)
  19. Incoming:RegisterForDrag("LeftButton")
  20. Incoming:SetScript("OnDragStart", function(self) self:StartMoving() end)
  21. Incoming:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end)
  22. Incoming:SetFrameStrata("FULLSCREEN_DIALOG")
  23.  
  24. local button = CreateFrame("button","IncomingButton", Incoming, "UIPanelButtonTemplate")
  25. button:SetHeight(24)
  26. button:SetWidth(60)
  27. button:SetPoint("BOTTOM", Incoming, "BOTTOM", 0, 10)
  28. button:SetText("Close")
  29. button:SetScript("OnClick", function(self)  self:GetParent():Hide() end)
  30.  
  31.  
  32. SLASH_SHARPEDGEINC1 = "/sinc"
  33. SlashCmdList.SHARPEDGEINC = function(msg)
  34.     Incoming:SetShown(not Incoming:IsShown())
  35. end

use /sincor whatever you renale "/sinc" to instead of /inc
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
09-17-22, 12:18 AM   #17
Sharpedge
A Cyclonian
 
Sharpedge's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2022
Posts: 42
Originally Posted by Fizzlemizz View Post
You're essentially taking control of another addon so you can't entirely rely on it's slash command(s). For this you will need to provide one of your own (in this case /sinc)

The .toc for your addon (the ## Dependencies: means the Incomming addon will load first.)
Lua Code:
  1. ## Interface:  90205
  2. ## Title: Sharpedge Inc
  3. ## Author: Sharpedge
  4. ## Version: 1.0.0
  5. ## Dependencies: Incoming
  6.  
  7. Sharpedge.lua

The Sharpedge.lua (or whatever you've called it)
Lua Code:
  1. local Incoming = CreateFrame("Frame", "SharpedgeIncommingFrame", UIParent, BackdropTemplateMixin and "BackdropTemplate");
  2. Incoming:SetBackdrop({
  3.       bgFile="Interface\\DialogFrame\\UI-DialogBox-Background",
  4.       edgeFile="Interface\\DialogFrame\\UI-DialogBox-Border",
  5.       tile=1, tileSize=32, edgeSize=32,
  6.       insets={left=11, right=12, top=12, bottom=11}
  7. })
  8. Incoming:Hide()
  9. LocationMessageView:SetParent(Incoming)
  10. LocationMessageView:Show()
  11. LocationMessageView:ClearAllPoints()
  12. LocationMessageView:SetPoint("TOP")
  13. LocationMessageView:SetMovable(false)
  14. LocationMessageView:EnableMouse(false)Incoming:SetWidth(139)
  15. Incoming:SetHeight(190)
  16. Incoming:SetPoint("CENTER",UIParent)
  17. Incoming:EnableMouse(true)
  18. Incoming:SetMovable(true)
  19. Incoming:RegisterForDrag("LeftButton")
  20. Incoming:SetScript("OnDragStart", function(self) self:StartMoving() end)
  21. Incoming:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end)
  22. Incoming:SetFrameStrata("FULLSCREEN_DIALOG")
  23.  
  24. local button = CreateFrame("button","IncomingButton", Incoming, "UIPanelButtonTemplate")
  25. button:SetHeight(24)
  26. button:SetWidth(60)
  27. button:SetPoint("BOTTOM", Incoming, "BOTTOM", 0, 10)
  28. button:SetText("Close")
  29. button:SetScript("OnClick", function(self)  self:GetParent():Hide() end)
  30.  
  31.  
  32. SLASH_SHARPEDGEINC1 = "/sinc"
  33. SlashCmdList.SHARPEDGEINC = function(msg)
  34.     Incoming:SetShown(not Incoming:IsShown())
  35. end

use /sincor whatever you renale "/sinc" to instead of /inc
Ok, everything is inside that panel now. Fits just right. But, the only button that works is the Close button. Whenever I click any of the others I get this message:

Code:
Message: [string "Incoming:OnClick"]:1: attempt to index global 'location_message_controller' (a nil value)
Time: Sat Sep 17 01:14:36 2022
Count: 1
Stack: [string "Incoming:OnClick"]:1: attempt to index global 'location_message_controller' (a nil value)
[string "*:OnClick"]:1: in function <[string "*:OnClick"]:1>

Locals: self = Incoming {
 0 = <userdata>
}
button = "LeftButton"
down = false
(*temporary) = nil
(*temporary) = nil
(*temporary) = "attempt to index global 'location_message_controller' (a nil value)"
  Reply With Quote
09-17-22, 01:26 AM   #18
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
Probably easier just apply a backdrop and close button to the addon frame

Lua Code:
  1. if BackdropTemplateMixin then
  2.     Mixin(LocationMessageView, BackdropTemplateMixin)
  3. end
  4. LocationMessageView:SetBackdrop({
  5.       bgFile="Interface\\DialogFrame\\UI-DialogBox-Background",
  6.       edgeFile="Interface\\DialogFrame\\UI-DialogBox-Border",
  7.       tile=1, tileSize=32, edgeSize=32,
  8.       insets={left=11, right=12, top=12, bottom=11}
  9. })
  10. LocationMessageView.Close = CreateFrame('Button', '$parentClose', LocationMessageView, "UIPanelCloseButton")
  11. LocationMessageView.Close:SetPoint('TOPRIGHT', 0,0)
  12. LocationMessageView.Close:SetSize(30, 30)
  13. LocationMessageView.Close:SetFrameLevel(4)
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 09-17-22 at 01:32 AM.
  Reply With Quote
09-17-22, 03:29 AM   #19
Sharpedge
A Cyclonian
 
Sharpedge's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2022
Posts: 42
Originally Posted by Fizzlemizz View Post
Probably easier just apply a backdrop and close button to the addon frame

Lua Code:
  1. if BackdropTemplateMixin then
  2.     Mixin(LocationMessageView, BackdropTemplateMixin)
  3. end
  4. LocationMessageView:SetBackdrop({
  5.       bgFile="Interface\\DialogFrame\\UI-DialogBox-Background",
  6.       edgeFile="Interface\\DialogFrame\\UI-DialogBox-Border",
  7.       tile=1, tileSize=32, edgeSize=32,
  8.       insets={left=11, right=12, top=12, bottom=11}
  9. })
  10. LocationMessageView.Close = CreateFrame('Button', '$parentClose', LocationMessageView, "UIPanelCloseButton")
  11. LocationMessageView.Close:SetPoint('TOPRIGHT', 0,0)
  12. LocationMessageView.Close:SetSize(30, 30)
  13. LocationMessageView.Close:SetFrameLevel(4)
It seems like its working. I had to do some adjustments to height, and kept the bottom Close button. I really appreciate all your help. I will most defiantly keep studying LUA. Thank you again for your help.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Need some help on XML to LUA

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off