Thread Tools Display Modes
Prev Previous Post   Next Post Next
03/23/15, 07:08 AM   #1
coolmodi
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 47
Added control in stat screen doesn't hide correctly

I made a addon to show me the mitigation from resistances, and someone wanted the same feature "MitigationValue" had to show it in the char screen too.

I basically used the same code that addon did for adding it to the stat screen:
Code:
function MitigationPercent:displayInCharScreen()
	
		ZO_StatsPanelPaneScrollChildStatsRow6:SetHeight(40)
		ZO_StatsPanelPaneScrollChildStatsRow6Stat1:SetAnchor(TOPLEFT, ZO_StatsPanelPaneScrollChildStatsRow6, TOPLEFT)
		ZO_StatsPanelPaneScrollChildStatsRow6Stat2:SetAnchor(TOPRIGHT, ZO_StatsPanelPaneScrollChildStatsRow6, TOPRIGHT)
		
		MitigationPercentSpell:SetParent(ZO_StatsPanel)
		local width = ZO_StatsPanelPaneScrollChildStatsRow6Stat1:GetWidth()
		width = width - ZO_StatsPanelPaneScrollChildStatsRow6Stat1DiminishingReturns:GetWidth()
		MitigationPercentSpell:SetWidth(width)
		MitigationPercentSpell:ClearAnchors()	
		MitigationPercentSpell:SetAnchor(TOPLEFT, ZO_StatsPanelPaneScrollChildStatsRow6Stat1, BOTTOMLEFT)
		MitigationPercentSpell:SetHidden(false)
		
		MitigationPercentPhys:SetParent(ZO_StatsPanel)
		width = ZO_StatsPanelPaneScrollChildStatsRow6Stat2:GetWidth()
		width = width - ZO_StatsPanelPaneScrollChildStatsRow6Stat2DiminishingReturns:GetWidth()
		MitigationPercentPhys:SetWidth(width)
		MitigationPercentPhys:ClearAnchors()	
		MitigationPercentPhys:SetAnchor(TOPLEFT, ZO_StatsPanelPaneScrollChildStatsRow6Stat2, BOTTOMLEFT)
		MitigationPercentPhys:SetHidden(false)
		
		MitigationPercent.OnStatsUpdated()
end
which is executed by
Code:
ZO_PreHook(ZO_Stats, "InitializeKeybindButtons", function() self:displayInCharScreen() end)
But while it mostly works as it should, it will not hide correctly the first time you close the stat screen and will only show and hide correctly after i open the map, use a buff, scroll in stat screen etc.

I have no clue why this is the case. I'm no programmer or anything (only do small things like this here), but i just can't see why it only works after one of those things happens. MitigationValue seems to have the same problem (now), so i think the game itself is at fault here, but i can't find a workaround that is possible to setup with the api tools i know of.

I hope someone here can help me

Edit:
Things i thought of but miss knowledge to do:
-Open and close the map (or any other thing that has the same effect, are there such functions?)
-showing and hiding my controls whenever the statscreen opens/closes (i can do hiding on close wit hthe popped event, but how can i check when it opens again?)

Last edited by coolmodi : 03/23/15 at 07:20 AM.
  Reply With Quote
 

ESOUI » Developer Discussions » Lua/XML Help » Added control in stat screen doesn't hide correctly


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off