I'm writing a small addon and right now one thing bothers me. Let's say, for example, that if I hover a character, if the player is out of range for inspection, a message is shown on the tooltip saying he's OOR (using GameTooltip:AddLine). But, if I get closer and the player is now in range, the tooltip is updated and now it shows the player is in range. I managed to do that if the tooltip is changed or hidden and then shown again (for example, if I move the mouse away and then re-hover the player). But what I want to do is to update the tooltip without having to hide or change the tooltip. I tried to use :Show() again when the unit is in range, but with no luck. Any way to refresh the tooltip to display a new data?
local line, unit
local function UpdateRangeText(self)
if line and unit then
if UnitInRange(unit) then
line:SetText("|cffff0000Out Of Range!|r")
name, unit = self:GetUnit()
-- Yes, the above are on two separate lines. It's deliberate.
if unit then
line = _G["GameTooltipTextLeft" .. self:NumLines()]
line, unit = nil, nil