View Single Post
10-06-16, 12:36 AM   #7
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by TokyoGhost View Post
So then I will have to update this code Im using from Phanx?
The WorldStateFrame doesn't have (and has never had) a TitleRegion, so the code you are using is not affected.

TitleRegion objects are typically used on "panel" type frames like the character window, LFG window, etc. to enable dragging the window around by its title bar (hence the name). It's always been kind of a redundant object type, and seems to only exist to enable dragging with a few less lines of code. I am surprised to hear it's being removed, but that's because I generally expect Blizzard to lazily leave ancient legacy code (and sometimes just hilariously bad code in general) around for all eternity, not because the object type is actually useful.

With a title region:
Code:
local dragger = frame:CreateTitleRegion()
dragger:SetPoint("TOPLEFT")
dragger:SetPoint("TOPRIGHT")
dragger:SetHeight(20)
Without a title region:
Code:
local dragger = CreateFrame("Frame", nil, frame)
dragger:SetPoint("TOPLEFT")
dragger:SetPoint("TOPRIGHT")
dragger:SetHeight(20)

dragger:RegisterForDrag("LeftButton")

dragger:SetScript("OnDragStart", function()
    frame:StartMovingOrSizing()
end)

dragger:SetScript("OnDragStop", function()
    frame:StopMoving()
end)
Addons rarely, if ever, use a TitleRegion anyway because it handles the movement automatically -- it doesn't give you a way to detect when the frame stops moving so you can save the new position into your addon's saved variables.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote