View Single Post
12-23-09, 10:52 AM   #15
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,877
Scratch that, sigh, WatchFrame_Expand errors out due to WatchFrame:GetTop() and WatchFrame:GetBottom() both being nil and thus unable to be calculated on.

Although, I may be doing something wrong using it. The Minimap file isn't a great example, not being an infopanel file. Anyways. Here's what I have so far in the 3 main functions. Anything out of place in these functions ? Oh, and this is the version of nUI that fixes the no unit frames error when you login, which I can confirm works as I changed back and started getting the error again, so went back to your fixed version

Code:
function ResetObjectivesFrame(parent, width, height)
			
	nUI_Options.movedWatchFrame = true;
	
	WatchFrame.moving = true;
	WatchFrame.sizing = true;
	
	WatchFrame:SetMovable( true );
	WatchFrame:SetResizable( true );
	WatchFrame:StartMoving();
	WatchFrame:StartSizing( "BOTTOMRIGHT" );
	
	WatchFrame:ClearAllPoints();
	WatchFrame:SetPoint( "BOTTOMRIGHT", parent, "BOTTOMRIGHT", 0, 0 );
	WatchFrame:SetPoint( "TOPLEFT", parent, "TOPLEFT", 0, 0 );
	WatchFrame:SetHeight( height );
	WatchFrame:SetWidth( width );

	WatchFrame.moving = nil;
	WatchFrame.sizing = nil;

	WATCHFRAME_IGNORECURSOR = "1";			
	WATCHFRAME_LASTWIDTH    = width;
	
	WatchFrame:StopMovingOrSizing();
	WatchFrame:SetUserPlaced( true );
	print("Top:",WatchFrame:GetTop(), "Bottom:", WatchFrame:GetBottom());
	WatchFrame_Expand( WatchFrame );

end
Code:
plugin.sizeChanged = function( scale, height, width )
	local options  = plugin.options;
	local Objectives   = plugin.Objectives;
	plugin.scale = scale;
	nUI_Movers:lockFrame( Objectives, false, OBJECTIVES_TRACKER_LABEL   );
	ResetObjectivesFrame(plugin.container, width, height);
	nUI_Movers:lockFrame( Objectives, true, nil );
end
Code:
plugin.setEnabled = function( enabled )
	if plugin.enabled ~= enabled then
		plugin.enabled = enabled;
		if not enabled then
			local Objectives = plugin.Objectives;
			if Objectives.saved_parent then
				nUI_Movers:lockFrame( Objectives, false, nil );
				Objectives:SetParent( Objectives.saved_parent );
				Objectives:SetPoint( "TOPRIGHT", MinimapCluster, "BOTTOMRIGHT", 0, 0 );
				Objectives:SetBackdropBorderColor( Objectives.border_color );
				Objectives:SetBackdropColor( Objectives.backdrop_color );
			end
		else
			local Objectives = WatchFrame;
			print(Objectives);
			plugin.Objectives = Objectives;
			if not Objectives.saved_parent then
				Objectives.saved_parent   = Objectives:GetParent();
				Objectives.border_color   = Objectives:GetBackdropBorderColor();
				Objectives.backdrop_color =Objectives:GetBackdropColor();
			end
			nUI_Movers:lockFrame( Objectives, false, OBJECTIVES_TRACKER_LABEL   );
			Objectives:SetParent( plugin.container );
			Objectives:ClearAllPoints();
			Objectives:SetPoint( "BOTTOMRIGHT", plugin.container, "BOTTOMRIGHT", 0, 0 );
			Objectives:SetPoint( "TOPLEFT", plugin.container, "TOPLEFT", 0, 0 );
			Objectives:Show();
			Objectives:SetFrameStrata( plugin.container:GetFrameStrata() );
			Objectives:SetFrameLevel( plugin.container:GetFrameLevel()+1 );
			Objectives:SetBackdropBorderColor( 0, 0, 0, 0 );
			Objectives:SetBackdropColor( 0, 0, 0, 0 );								
			nUI_Movers:lockFrame( Objectives, true, nil );
		end				
	end			
end
Errors Received:
Code:
[2009/12/23 16:50:10-231-x1]: Interface\FrameXML\WatchFrame.lua:341: attempt to perform arithmetic on a nil value:
Interface\FrameXML\WatchFrame.lua:297: in function `WatchFrame_Expand':
...UI_InfoPanel_Objectives\nUI_InfoPanel_Objectives.lua:62: in function `ResetObjectivesFrame':
...UI_InfoPanel_Objectives\nUI_InfoPanel_Objectives.lua:102: in function `sizeChanged':
nUI-5.06.06 (Lite)\Integration\nUI_InfoPanel.lua:803: in function `applyScale'
nUI-5.06.06 (Lite)\Integration\nUI_InfoPanel.lua:908: in function `applyOptions'
nUI-5.06.06 (Lite)\Integration\nUI_InfoPanel.lua:937: in function `applySkin'
nUI-5.06.06 (Lite)\Main\nUI.lua:248: in function <Interface\AddOns\nUI\Main\nUI.lua:137>
__________________