Before I had this XML - I didn't write it myself but it worked 100% perfectly...
Code:
<Frame name="OW_secureFrames" hidden="true" virtual="true" inherits="SecureActionButtonTemplate" parent="UIParent"/>
<Button name="OW_BuffFrame" hidden="false" inherits="OW_secureFrames" enableMouse="true">
<Scripts>
<OnLoad>
this:RegisterForClicks("AnyUp")
</OnLoad>
<PreClick>
-- lots of preclick code here
</PreClick>
<PostClick>
-- lots of postclick code here
</PostClick>
</Scripts>
</Button>
I translated it into LUA as follows
Code:
function OW_preclick(self)
-- same preclick code except 'this' is replaced with 'self'
end
function OW_postclick(self)
-- same postclick code except 'this' is replaced with 'self'
end
local secureFrame = CreateFrame("Frame","OW_secureFrames",UIParent,"SecureActionButtonTemplate")
local secureButton = CreateFrame("Button","OW_BuffFrame",nil,secureFrame)
secureButton:RegisterForClicks("AnyUp")
secureButton:SetScript("PreClick",OW_preclick)
secureButton:SetScript("PostClick",OW_postclick)
The button is bound to the mousewheel - and the LUA version works perfectly EXCEPT that the button isn't "clicked"
The preclick and postclick both fire - their results (setting attributes) are EXACTLY the same - but the button never 'clicks' (e.g. does the actions which are being setup in the preclick)...
What did I miss????