View Single Post
09-17-22, 12:18 AM   #17
Sharpedge
A Wyrmkin Dreamwalker
 
Sharpedge's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2022
Posts: 54
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