Well, so thought I'd start over kinda and start with tying the WatchFrame to this new ScrollFrame thingy
For some reason it isn't parenting the WatchFrame properly, which could be why it didn't work with the infopanel as I expected.
Apart from some slight positioning offsets it is positioning itself correctly but the moment I move the scroll frame the WatchFrame doesn't move with it despite me setting its new parent to it.
Here's the code portion that creates the ScrollFrame and Scroller:
Code:
-- Create Main Scroll Frame
local f = CreateFrame( "ScrollFrame", "WatchFrameScrollFrame", UIParent, "UIPanelScrollFrameTemplate" );
f:SetWidth(400);
f:SetHeight(200);
f:SetClampedToScreen(true);
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(button);
f:EnableMouse(true);
f:SetMovable(true);
f:SetScript("OnMouseDown",ObjectivesOnMouseDown);
f:SetScript("OnMouseUp",ObjectivesOnMouseUp);
f:SetScript("OnHide",ObjectivesOnHide);
-- Create Scroll Frame Scroller Frame
f.scroller = CreateFrame( "Frame", "$parent_Scroller", f );
f.scroller:SetWidth( f:GetWidth() );
f.scroller:SetWidth( f:GetHeight() );
-- Tell WoW Which Frame is the Scroll child
f:SetScrollChild( f.scroller );
return f;
And here's the WatchFrame Resize Function :
Code:
local function ResetWatchFrame()
nUI_Options.movedWatchFrame = true;
WatchFrame.moving = true;
WatchFrame.sizing = true;
WatchFrame:SetMovable( true );
WatchFrame:SetResizable( true );
WatchFrame:StartMoving();
WatchFrame:StartSizing( "BOTTOMRIGHT" );
WatchFrame:ClearAllPoints();
WatchFrame:SetParent(WatchFrameScrollFrame);
WatchFrame:SetPoint( "BOTTOMRIGHT", WatchFrameScrollFrame, "BOTTOMRIGHT", 0, 0 );
WatchFrame:SetPoint( "TOPLEFT", WatchFrameScrollFrame, "TOPLEFT", 0, 0 );
WatchFrame:SetHeight( 640 ); -- WatchFrameScrollFrame:GetHeight() );
WatchFrame:SetWidth( WatchFrameScrollFrame:GetWidth() );
WatchFrame.moving = nil;
WatchFrame.sizing = nil;
WATCHFRAME_IGNORECURSOR = "1";
WATCHFRAME_LASTWIDTH = WatchFrameScrollFrame:GetWidth() ;
WatchFrame:StopMovingOrSizing();
WatchFrame:SetUserPlaced( true );
print("Top:",WatchFrame:GetTop(), "Bottom:", WatchFrame:GetBottom());
WatchFrame_Expand( WatchFrame );
end
And finally, the piece of code that the addon executes :
Code:
local plugin = CreateFrame( "Frame", "Mini_ObjectiveFrame", UIParent );
local function onEvent()
if event == "VARIABLES_LOADED" then
WatchFrameScrollFrame = CreateScrollFrame();
nUI_Movers:lockFrame( WatchFrame, false, nil );
ResetWatchFrame();
nUI_Movers:lockFrame( WatchFrame, true, nil );
end
end
plugin:SetScript( "OnEvent", onEvent );
plugin:RegisterEvent( "VARIABLES_LOADED" );