Thread Tools Display Modes
12-22-14, 12:46 AM   #21
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
Originally Posted by Resike View Post
I have no issues with that, so it's probably caused by another addon, mostly map addons could cause this.
I wasted so much time on finding a work around for that and it was my cheap hack to get quest levels shown in the quest log.
Code:
local oldEnv = getfenv(QuestLogQuests_Update)
setfenv(QuestLogQuests_Update, setmetatable({ ENABLE_COLORBLIND_MODE = '1' }, { __index = oldEnv }))
  Reply With Quote
12-22-14, 02:59 AM   #22
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
Originally Posted by Xrystal View Post
Well, rigged up a mini addon, to create a scrolling frame to hold the tracker frame in and all seems fine except ...

I need that line that is commented out to keep the offset correct for my frame as otherwise the POI Icons and half of the check marks are too far left and are invisible. However, the moment I use that line it causes the taint message. This is a very basic version to my addon but visually it is useless without that offset being able to be used.
Give this a shot:
Code:
local addonName, addon = ...

local options = {
	width = 445,
	height = 130,
	isMovable = true,
	hasBorder = true,
--	scale = 1.1,
}

local scrollFrame = CreateFrame('ScrollFrame', "XrystalScrollFrame_ObjectivesTracker", UIParent, 'UIPanelScrollFrameTemplate')
scrollFrame:SetFrameStrata(ObjectiveTrackerFrame:GetFrameStrata())
scrollFrame:SetSize(options.width, options.height)
scrollFrame:SetPoint('CENTER', 10, -10)

if options.hasBorder then
	local border = CreateFrame('Frame', nil, scrollFrame)
	border:SetFrameLevel(scrollFrame:GetFrameLevel() - 1)
	border:SetPoint('TOPLEFT', -10, 10)
	border:SetPoint('BOTTOMRIGHT', 35, -10)

	border:SetBackdrop({       
		bgFile = [[Interface\Tooltips\UI-Tooltip-Background]],
		edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]],
		tile = true,
		tileSize = 16,
		edgeSize = 16,
		insets = { left = 4, right = 4, top = 4, bottom = 4 }
	})
	border:SetBackdropBorderColor(1, 1, 0, 1)
	border:SetBackdropColor(0, 0, 0, 1)
end

if options.isMovable then
	scrollFrame:EnableMouse(true)
	scrollFrame:SetMovable(true)
	scrollFrame:SetUserPlaced(true)
	scrollFrame:SetClampedToScreen(true)
	scrollFrame:RegisterForDrag('LeftButton')
	scrollFrame:SetScript('OnDragStart', scrollFrame.StartMoving)
	scrollFrame:SetScript('OnDragStop', scrollFrame.StopMovingOrSizing)
	scrollFrame:SetScript('OnHide', scrollFrame.StopMovingOrSizing)
end

if options.scale then
	ObjectiveTrackerFrame:SetScale(options.scale)
end

local scrollBar = scrollFrame.ScrollBar
scrollBar:SetPoint('LEFT', frame, 'RIGHT', 5, 0)

local scrollChild = ObjectiveTrackerFrame.HeaderMenu.MinimizeButton
scrollChild:SetParent(UIParent)
scrollChild:ClearAllPoints()
scrollChild:SetPoint('TOPLEFT', scrollFrame)
scrollChild:SetSize(options.width - 30, 1080)
scrollChild:EnableMouse(false)

ObjectiveTrackerFrame:SetParent(scrollChild)
scrollFrame:SetScrollChild(scrollChild)

local frame = EnumerateFrames()
while frame do
	if not frame.UIParentManageFramePositions then
		frame = EnumerateFrames(frame)
	else
		hooksecurefunc(frame, 'UIParentManageFramePositions', function()
			ObjectiveTrackerFrame:ClearAllPoints()
			ObjectiveTrackerFrame:SetPoint('TOPLEFT', 30, 0)
			ObjectiveTrackerFrame:SetPoint('BOTTOMRIGHT')
		end)
		frame = nil
	end
end

ObjectiveTrackerFrame:SetScript('OnSizeChanged', nil)

local function SetScrollLimit(maxOffset)
	scrollBar:SetMinMaxValues(0, maxOffset)
	local offset = scrollBar:GetValue()
	scrollBar.ScrollUpButton:SetEnabled(offset > 0.005)
	scrollBar.ScrollDownButton:SetEnabled(maxOffset - offset > 0.005)
end

local function ScrollFrame_OnUpdate(self)
	self:SetScript('OnUpdate', nil)

	local modules, top = ObjectiveTrackerFrame.MODULES, ObjectiveTrackerFrame:GetTop()
	local bottom = top
	if modules then
		for index = 1, #modules do
			for _, block in pairs(modules[index].usedBlocks) do
				for _, line in pairs(block.lines) do
					if line.used then
						local lineBottom = line:GetBottom() or top
						if lineBottom < bottom then
							bottom = lineBottom
						end
					end
				end
			end
		end
	end

	local maxOffset = top - bottom - options.height
	SetScrollLimit(maxOffset >= 0 and maxOffset or 0)
end

local inCombat
local function QueueScrollRangeUpdate()
	if not inCombat then
		scrollFrame:SetScript('OnUpdate', ScrollFrame_OnUpdate)
	end
end

hooksecurefunc('ObjectiveTracker_Update', QueueScrollRangeUpdate)
scrollFrame:SetScript('OnHide', QueueScrollRangeUpdate)

scrollFrame:SetScript('OnEvent', function(self, event)
	if event == 'PLAYER_REGEN_DISABLED' then
		inCombat = true
		self:SetScript('OnUpdate', nil)
		SetScrollLimit(1080 - options.height)
	else
		inCombat = nil
		self:SetScript('OnUpdate', ScrollFrame_OnUpdate)
	end
end)
scrollFrame:RegisterEvent('PLAYER_REGEN_DISABLED')
scrollFrame:RegisterEvent('PLAYER_REGEN_ENABLED')

local function ClaimTexture(frame, texture, key)
	texture:SetParent(frame)
	texture:ClearAllPoints()
	texture:SetAllPoints()
	if key then
		frame[key] = texture
	end
end

local minimizeButton = CreateFrame('Button', nil, UIParent, 'SecureHandlerClickTemplate')
minimizeButton:SetFrameStrata(ObjectiveTrackerFrame:GetFrameStrata())
minimizeButton:SetFrameLevel(ObjectiveTrackerFrame:GetFrameLevel() + 2)
minimizeButton:SetPoint('TOPRIGHT', scrollFrame, 'TOPLEFT', 10, 7)
minimizeButton:SetSize(16, 16)

ClaimTexture(minimizeButton, scrollChild:GetNormalTexture(), "normalTexture")
ClaimTexture(minimizeButton, scrollChild:GetPushedTexture(), "pushedTexture")
ClaimTexture(minimizeButton, scrollChild:GetHighlightTexture())

scrollFrame:SetScript('OnHide', function()
	minimizeButton.normalTexture:SetTexCoord(0, 0.5, 0, 0.5)
	minimizeButton.pushedTexture:SetTexCoord(0.5, 1, 0, 0.5)
end)

scrollFrame:SetScript('OnShow', function()
	minimizeButton.normalTexture:SetTexCoord(0, 0.5, 0.5, 1)
	minimizeButton.pushedTexture:SetTexCoord(0.5, 1, 0.5, 1)
end)

minimizeButton:SetFrameRef("scrollFrame", scrollFrame)
minimizeButton:Execute([[
	scrollFrame = self:GetFrameRef("scrollFrame")
	self:SetAttribute("frameref-scrollFrame", nil)
]])
minimizeButton:SetAttribute('_onclick', [[
	scrollFrame[scrollFrame:IsShown() and 'Hide' or 'Show'](scrollFrame)
]])
There are a couple issues with dynamically updating the scroll range but otherwise it seems to behave ok.
  Reply With Quote
12-22-14, 02:17 PM   #23
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,892
Thanks Vrul. Will give it a whirl during my 2 days off over xmas.
__________________
  Reply With Quote
12-25-14, 07:30 AM   #24
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,892
Thanks, that code seems to resolve the problems I was having, so now I just have to figure out how half of that stuff you put in there works Then see if it works in my original idea and with nUI turned on. The latter is where it may fall apart as nUI also messes with the tracker which my addon tells it to stop.


edit:
Well, looks like I am still stuck with the original coding for now in my addon. This code only seems to work if I don't have nUI loaded. Looks like it will take some code changes to get it working with nUI if it is at all possible.
__________________

Last edited by Xrystal : 12-25-14 at 12:39 PM.
  Reply With Quote
12-31-14, 05:18 PM   #25
siweia
A Flamescale Wyrmkin
 
siweia's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2011
Posts: 126
Guys try this.

http://www.curse.com/addons/wow/questitembuttonfix

Although it's has some problems, eg. won't update cool down correctly. And sometimes the icon won't hide even the quest item no longer exists.

Last edited by siweia : 12-31-14 at 05:28 PM.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Unable to click quest button

Thread Tools
Display Modes

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