Thread Tools Display Modes
09-07-08, 07:18 PM   #1
kerrang
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Oct 2006
Posts: 109
Translating some XML into LUA - what did I miss...

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????
  Reply With Quote
09-07-08, 07:30 PM   #2
kerrang
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Oct 2006
Posts: 109
To answer my own question again

I removed the "secureFrame = ..." line and changed the next line to read

Code:
local secureButton = CreateFrame("Button","OW_BuffFrame",nil,"SecureActionButtonTemplate")
NO idea why that works and the other didn't but I live and learn
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Translating some XML into LUA - what did I miss...


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