WoW:XML/Script: Difference between revisions

1,853 bytes added ,  15 August 2023
m
Move page script moved page XML/Script to WoW:XML/Script without leaving a redirect
(Created page with "{{uixmltype}} Script is way to add handler code to a UI element. Script is base type that is not used directly, but added to <Scripts> using on...")
 
m (Move page script moved page XML/Script to WoW:XML/Script without leaving a redirect)
 
(24 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>
<Frame name="Frame1">
<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


== Attributes ==
== Xsd ==
* inherit ([[XML types#SCRIPTINHERITTYPE|SCRIPTINHERITTYPE]]) (optional) - order to run this script relative to any inherited scripts. Default is 'none'.
<pre>
* function {{attrtype|string}} (optional) - global name of function to call, in lieu of inline text.
<xs:complexType name="ScriptType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="function" type="xs:string"/>
<xs:attribute name="method" type="xs:string"/><!-- new after 7.1 -->
<xs:attribute name="inherit" type="SCRIPTINHERITTYPE" use="optional" default="none"/>
<xs:attribute name="intrinsicOrder" type="SCRIPTINTRINSICORDERTYPE" use="optional" default="none"/><!-- after 7.1 -->
<xs:attribute name="autoEnableInput" type="xs:boolean" default="true"/><!-- new after 7.2.5 -->
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</pre>


== Summary ==
== Summary ==
Line 29: 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 39: 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