Quantcast
Weird mouse behaviour - WoWInterface
Thread Tools Display Modes
07-30-06, 12:49 AM   #1
LaRIC
Premium Member
 
LaRIC's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 23
Question Weird mouse behaviour

I have done the frame below and it works fine.

However I want the frame to be draggable and as far as I know I should use the code that is commented out.

But once I do that the frame get stuck to the mouse pointer all the time. What am I doing wrong?

-- initializing saved variables

aofhVisible = true
aofhGrouppercent = 85
aofhRaidpercent = 60




-- Frame functions
function AoFHeal_Function_OnLoad()
end

function AoFHeal_Function_OnEvent( event )
end

function AoFHeal_Function_OnDragStart()
aofhf:StartMoving();
end

function AoFHeal_Function_OnDragStop()
aofhf:StopMovingOrSizing();
end

function AoFHeal_Function_Update(elapsed)
end

-- Creating a frame

aofhf = CreateFrame("Frame","AofHeal_Frame_Main",UIParent)
aofhf:SetFrameStrata("LOW")
aofhf:SetWidth(160)
aofhf:SetHeight(110)
aofhf:SetBackdrop({bgFile = "Interface/DialogFrame/UI-DialogBox-Background",
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
tile = true, tileSize = 32, edgeSize = 16,
insets = { left = 5, right = 5, top = 5, bottom = 5 }});
aofhftit = aofhf:CreateFontString("aofh_title","BACKGROUND",GameFontNormalSmall)
aofhftit:SetFont(STANDARD_TEXT_FONT, 20, "OUTLINE")
aofhftit:SetTextColor(1, 1, 0.2)
aofhftit:SetPoint("TOP", aofhf, "TOP", 0, 15)
aofhftit:SetText("AoF Heal")

aofhf:SetPoint("CENTER",0,0)
--aofhf:SetMovable(true)
--aofhf:EnableMouse(true)
--aofhf:SetScript("OnDragStart",AoFHeal_Function_OnDragStart())
--aofhf:SetScript("OnDragStop",AoFHeal_Function_OnDragStop())
--aofhf:SetScript("OnMouseUp",AoFHeal_Function_OnDragStop())
aofhf:Show()
  Reply With Quote
07-30-06, 01:49 AM   #2
LaRIC
Premium Member
 
LaRIC's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 23
Actually I found the problem at last.

--Frame Functions
function AoFHeal_Function_OnMouseUp()
if ( aofhf.isMoving ) then
aofhf:StopMovingOrSizing();
aofhf.isMoving = false;
end
end
function AoFHeal_Function_OnMouseDown()
if ( ( ( not aofhf.isLocked ) or ( aofhf.isLocked == 0 ) ) and ( arg1 == "LeftButton" ) ) then
aofhf:StartMoving();
aofhf.isMoving = true;
end
end
function AoFHeal_Function_OnHide()
if ( ( ( not aofhf.isLocked ) or ( aofhf.isLocked == 0 ) ) and ( arg1 == "LeftButton" ) ) then
aofhf:StartMoving();
aofhf.isMoving = true;
end
end
-- Creating a frame
aofhf = CreateFrame("Frame","AofHeal_Frame_Main",UIParent)
aofhf:SetMovable(true)
aofhf:EnableMouse(true)
aofhf:SetScript("OnMouseUp",AoFHeal_Function_OnMouseUp)
aofhf:SetScript("OnMouseDown",AoFHeal_Function_OnMouseDown)
aofhf:SetScript("OnHide",AoFHeal_Function_OnHide)
aofhf:SetFrameStrata("LOW")
aofhf:SetWidth(160)
aofhf:SetHeight(110)
aofhf:SetBackdrop({bgFile = "Interface/DialogFrame/UI-DialogBox-Background",
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
tile = true, tileSize = 32, edgeSize = 16,
insets = { left = 5, right = 5, top = 5, bottom = 5 }});
aofhftit = aofhf:CreateFontString("aofh_title","BACKGROUND",GameFontNormalSmall)
aofhftit:SetFont(STANDARD_TEXT_FONT, 11, "OUTLINE")
aofhftit:SetTextColor(1, 1, 0.2)
aofhftit:SetPoint("TOP", aofhf, "TOP", 0, 15)
aofhftit:SetText("AoF Heal")
aofhf:SetPoint("CENTER",0,0)
aofhf:RegisterForDrag("LeftButton")
aofhf:Show()
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Weird mouse behaviour

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