WoW:XML/Script: Difference between revisions

420 bytes added ,  15 August 2023
m
Move page script moved page XML/Script to WoW:XML/Script without leaving a redirect
m (Move page script moved page XML/Script to WoW:XML/Script without leaving a redirect)
 
(14 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{uixmltype}}
{{uixmlprop}}
 
[[XML/Script|Script]] is way to add handler code to a UI element. Script is base type that is not used directly, but added to <[[XML/Scripts|Scripts]]> using one of the specific handler types such as 'OnClick'. The Script type provides a base type for all of the hander types.
[[XML/Script|Script]] is way to add handler code to a UI element. Script is base type that is not used directly, but added to <[[XML/Scripts|Scripts]]> using one of the specific handler types such as 'OnClick'. The Script type provides a base type for all of the hander types.


== Inheritance ==
== Inheritance ==
Inherited by: OnClick, OnEnter, OnLoad, OnEvent ..., Inherits: none, Defined in: [[XML/Scripts|Scripts]]
Inherited by: OnClick, OnEnter, OnLoad, OnEvent ..., Inherits: none, Defined in: [[XML/Scripts|Scripts]],
Runtime object: [[UIOBJECT_Script]]
Runtime object: [[UIOBJECT_Script]]


Line 11: Line 10:


== Attributes ==
== Attributes ==
* function {{attrtype|string}} (optional) - global name of function to call, in lieu of inline text.
* function {{attrtype|string}} (optional)
* method {{attrtype|string}} (optional) - this frame Lua object or 'mixin' name of function to call, in lieu of inline text.
*: named function to call using a simple global name. Can be used instead of in payload with inline script text.
* inherit ([[XML types#SCRIPTINHERITTYPE|SCRIPTINHERITTYPE]]) (optional) - order to run this script relative to any inherited scripts for this event. Default is 'none'.
* method {{attrtype|string}} (optional)
* intrinsicOrder ([[XML types#SCRIPTINTRINSICORDERTYPE|SCRIPTINTRINSICORDERTYPE]]) (optional) - order to run this script relative to any implementation scripts for this event. Used only in an intrinsic definition. Default is 'none'.  
*: named method to call using this frame's Lua table or 'mixin' name of function to call, in lieu of inline text or 'function'.
* autoEnableInput {{attrtype|boolean}} (optional) - Unknown. Is set 'false' on a few mouse events for ScrollingMessageFrame and TextStatusBar and seems to have something to do with not activating text box under certain circumstances. Default is 'true'.
* inherit ([[XML types#SCRIPTINHERITTYPE|SCRIPTINHERITTYPE]]) (optional)
*: order to run this script relative to any other scripts for this event including any 'inherited'. Default is 'none'.
* intrinsicOrder ([[XML types#SCRIPTINTRINSICORDERTYPE|SCRIPTINTRINSICORDERTYPE]]) (optional)
*: order to run this script relative to any implementation scripts for this event. Used only in an intrinsic definition. Default is 'none'.  
* autoEnableInput {{attrtype|boolean}} (optional)
*: Unknown. Is set 'false' on a few mouse events for ScrollingMessageFrame and TextStatusBar and seems to have something to do with not activating text box under certain circumstances. Default is 'true'.


== Payload ==
== Payload ==
* (optional) - Lua script as plain text called as a Lua function.
* (optional) - Lua script as plain text called as a Lua function.
 
<pre>
=== Lua parameters ===
<Frame name="Frame1">
* self - the container table. For a Frame is the scripts Lua frame table itself
<Scripts>
<OnMouseUp>
print(self:GetName(), event, ...) -- payload
</OnMouseUp>
</Scripts>
</Frame>
</pre>
=== Parameters ===
Lua script parameters set by the engine for use by the inline script.
* self - (table) the Lua table automatically genmerated for the frame  
* event - (string) the name of the wow event
* ... - the remaining Lua args list including any event arguments
* ... - the remaining Lua args list including any event arguments


Line 51: Line 65:
       <[[XML/Scripts|Scripts]]>
       <[[XML/Scripts|Scripts]]>
         <[[XML/Script|OnMouseUp]]>
         <[[XML/Script|OnMouseUp]]>
             print(self:GetName(), "clicked", ...)
             print(self:GetName(), "clicked", event, ...)
         </OnMouseUp>
         </OnMouseUp>
       </Scripts>
       </Scripts>
Line 61: Line 75:


== See also ==
== See also ==
* [[XML/Scripts]] - for outer parent element
* [[XML_properties#Scripts]] - for a list of handlers
* [[XML_properties#Scripts]] - for a list of handlers
* [[Widget handlers]] - for which handlers work with which elements  
* [[Widget handlers]] - for which handlers work with which elements  
* [[:Category:Widget event handlers]]
* [[:Category:Widget event handlers]]
Anonymous user