I've struggled with this for a few days and I'm getting really frustrated, so maybe someone here can help (or point me in the right direction). I'm trying to create a FuBar plugin that displays something in a window (frame) when the user clicks a tool tip and/or an option menu (I can't get either to work).
I started with XML files (using the Faraframes tutorial) but couldn't get that to work. I eventually dropped back to using CreateFrame just to try and get *anything* to display! I either get a) nothing happening (except for my debug messages) or b) an error about SetOwner (due to a nil value). I have never been able to get any window at all to display.
Here's a snippet of the current code -- I've tweaked it several different ways based on code I've dug out of other addons, but I 'm thinking that there's something else I'm missing. And I *am* a Java/jsp/php developer, so I'm not a total idiot (which makes this all the more frustrating).
Typical Fubar/Ace2 tooltip code:
Code:
ALG = AceLibrary("AceAddon-2.0"):new("FuBarPlugin-2.0", "AceConsole-2.0")
ALG.hasIcon = "Interface\\AddOns\\ALevelGuide\\guide"
ALG.cannotDetachTooltip = true
ALG.clickableTooltip = true
local Tablet = AceLibrary("Tablet-2.0")
function ALG:OnTooltipUpdate()
local cat = Tablet:AddCategory();
local line = cat:AddLine('text',"Test1", "func", "Show 1", "arg1", self, "arg2", 1);
line = cat:AddLine('text', "Test2");
Tablet:SetHint("Click me! \nIf you know what's good for ya!")
end
Generic click Handler
Code:
function ALG:ShowGuide(guideNumber)
self:Print("Generic Showguide called")
self:CreateAWindow()
self:ShowText("back from CAW")
end
Code to actually show the frame:
Code:
function ALG:CreateAWindow()
local f = CreateFrame("Frame","ALGFrame",Tablet20Frame, "GameTooltipTemplate");
ALGFrame:SetOwner(Tablet20Frame,"ANCHOR_NONE");
ALGFrame:SetScale(Tablet:GetFontSizePercent(FuBar.db.profile.tooltip));
ALGFrame:ClearAllPoints();
ALGFrame:AddLine("Sample text");
ALGFrame:Show();
self:Print("end of CreateA Window");
end
All this code resides in a single main.lua file and it's definitely getting run since the chat outputs are showing up.
Any and all help is appreciated.