Okay, the good news is it seems to be working consistently with the following code changed regardless as to whether nUI is loaded or not. However, it still is adamant about sitting in the background as if it is still owned by UIParent.
Thanks for that Scott. I'm gonna spend some time reading through WatchFrame again and see if it is trying to do something else with it based on an event and see if I can trap it happening and stop it. The rest of the code is the same as before.
Code:
local function CreateScrollFrame()
if ( nUI_Loaded ) then
nUI_Movers:lockFrame( WatchFrame, false, nil ); -- OBJECTIVES_TRACKER_LABEL );
end
local f = CreateFrame( "Frame", "WatchFrame_Container",UIParent);
f:SetWidth(400);
f:SetHeight(200);
f:SetClampedToScreen(true);
f:SetFrameStrata("HIGH");
f:SetPoint("CENTER",UIParent,"CENTER",0,0);
f:SetBackdrop(ObjectivesBackdrop);
f:SetBackdropColor(ObjectivesBackcolor.red,ObjectivesBackcolor.green,ObjectivesBackcolor.blue, ObjectivesBackcolor.alpha);
f:SetBackdropBorderColor(ObjectivesBordercolor.red, ObjectivesBordercolor.green,ObjectivesBordercolor.blue, ObjectivesBordercolor.alpha);
f:RegisterForDrag("LeftButton");
f:EnableMouse(true);
f:SetMovable(true);
f:SetScript("OnMouseDown",OnMouseDown);
f:SetScript("OnMouseUp",OnMouseUp);
f:SetScript("OnHide",OnHide);
local s = CreateFrame( "ScrollFrame", "WatchFrame_ScrollFrame", f, "UIPanelScrollFrameTemplate" );
s:SetPoint("TOPLEFT", 5, -5);
s:SetPoint("BOTTOMRIGHT", -30, 5);
f.Scroll = s;
s:SetScrollChild(WatchFrame);
f.Child = WatchFrame;
ResetWatchFrame(s);
if ( nUI_Loaded ) then
nUI_ResetWatchFrame = function() end;
end
WatchFrame.ClearAllPoints = function() end
WatchFrame.SetPoint = function() end
WatchFrame.SetAllPoints = function() end
--[[
local c = CreateFrame("Frame","WatchFrame_ScrollChild",s);
s:SetScrollChild(c);
c:SetWidth(2);
c:SetHeight(2);
c:SetAllPoints(s);
f.Child = c;
--]]
return f;
end
local plugin = CreateFrame( "Frame", "Mini_ObjectiveFrame", UIParent );
local function onEvent()
if event == "VARIABLES_LOADED" then
WatchFrameScrollFrame = CreateScrollFrame();
--ResetWatchFrame(WatchFrameScrollFrame.Child);
elseif event == "ADDON_LOADED" then
nUI_Loaded = false;
if ( arg1 == "nUI" ) then
nUI_Loaded = true;
plugin:UnregisterEvent( "ADDON_LOADED" );
end
end
end