WoW:XML/Script: Difference between revisions

640 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)
 
(19 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]]


== Elements ==
== Elements ==
:none
:none
== Attributes ==
* function {{attrtype|string}} (optional)
*: named function to call using a simple global name. Can be used instead of in payload with inline script text.
* method {{attrtype|string}} (optional)
*: named method to call using this frame's Lua table or 'mixin' name of function to call, in lieu of inline text or 'function'.
* 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.
* (optional) - Lua script as plain text called as a Lua function.
 
<pre>
== Attributes ==
<Frame name="Frame1">
* function {{attrtype|string}} (optional) - global name of function to call, in lieu of inline text.
<Scripts>
* method {{attrtype|string}} (optional) - this frame Lua object or 'mixin' name of function to call, in lieu of inline text.
<OnMouseUp>
* inherit ([[XML types#SCRIPTINHERITTYPE|SCRIPTINHERITTYPE]]) (optional) - order to run this script relative to any inherited scripts for this event. Default is 'none'.
print(self:GetName(), event, ...) -- payload
* intrinsicOrder ([[XML types#SCRIPTINTRINSICORDERTYPE|SCRIPTINTRINSICORDERTYPE]]) (optional) - order to run this script relative to any implementation scripts for this event. Default is 'none'. Used only in an intrinsic definition.
</OnMouseUp>
* autoEnableInput {{attrtype|boolean}} (optional) - Unknown. Is on a few mouse events ScrollingMessageFrame and TextStatusBar and seems to have something to do with not activating text box under certain circumstances. Default is 'true'.
</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


== Xsd ==
== Xsd ==
Line 47: 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 57: 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