2. Lock/Unlock the frame.... I can lock or unlock the frame ok buut it clings to the cursor and you have to click it twice as per above to unlock it.
The code:
Code:
<OnClick>
if DWMPackBaseFrame.FrameLockCheckButton then
DWMPackBaseFrame.FrameLockCheckButton = false
DWMPackBaseFrame:StartMoving();
else
DWMPackBaseFrame.FrameLockCheckButton = true
DWMPackBaseFrame:StopMovingOrSizing();
end
self:SetChecked(DWMPackBaseFrame.FrameLockCheckButton)
</OnClick>
|
Just looked over it again and noticed what was wrong. When the button is clicked, you just want to change the button/setting correct? With your current setup it's doing what it's supposed to: the frame will
always be "moving" until you uncheck the button. I'm assuming you're simply looking to lock dragging. In which you would:
XML BUTTON:
Code:
<OnClick>
if DWMPackBaseFrame.FrameLockCheckButton then
DWMPackBaseFrame.FrameLockCheckButton = false
else
DWMPackBaseFrame.FrameLockCheckButton = true
end
self:SetChecked(DWMPackBaseFrame.FrameLockCheckButton)
</OnClick>
On the frame itself, when you specify the movement script you would make the lock check. In your frame's script tag:
Code:
<Scripts>
<OnDragStart>function(self)
if DWMPackBaseFrame.FrameLockCheckButton == true then return end <!- do nothing, frame locked ->
else
self:StartMoving()
end
</OnDragStart>
<OnDragStop>self:StopMovingOrSizing()</OnDragStop>
</Scripts>
Now I'm sure I screwed up the formatting (again, haven't used XML in ages) but should give you a general idea to make it work correctly.