You will undoubtably kick yourself for this but add
Code:
MinimapButton:Load()
to the end.
Also why have you got
Code:
local B = CreateFrame('Button', "MainMenuBarToggler", Minimap)
local MinimapButton = B
wouldn't
Code:
local MinimapButton = CreateFrame('Button', "MainMenuBarToggler", Minimap)
achieve exactly the same thing?
and you have no drag enter leave etc. functions so arn't all the :SetScript() pointless
Code:
self:SetScript('OnEnter', self.OnEnter)
self:SetScript('OnLeave', self.OnLeave)
self:SetScript('OnClick', self.OnClick)
self:SetScript('OnDragStart', self.OnDragStart)
self:SetScript('OnDragStop', self.OnDragStop)
self:SetScript('OnMouseDown', self.OnMouseDown)
self:SetScript('OnMouseUp', self.OnMouseUp)
appart from
Code:
self:SetScript('OnClick', self.OnClick)
and finally you have already set the parent of the button to Minimap in
Code:
CreateFrame('Button', "MainMenuBarToggler", Minimap)
so why do you do it in :Load()
Code:
self:SetParent(Minimap)