CVguiJavascriptContext: Difference between revisions

From Empires Wiki
Jump to navigation Jump to search
(Created page with "This [https://developer.valvesoftware.com/wiki/VGUI2 VGUI] element allows you to define its layout using res files and its behavior using javascript. == Attributes == This el...")
 
No edit summary
Line 8: Line 8:
== Javascript ==
== Javascript ==
You can use javascript to add behavior to your element. By default the [http://empires_public.docs.empiresmod.com/empires_stdlib/stdlib/ standard library] and [http://empires_public.docs.empiresmod.com/empires_stdlib/vgui/ vgui library] are available for you to use.
You can use javascript to add behavior to your element. By default the [http://empires_public.docs.empiresmod.com/empires_stdlib/stdlib/ standard library] and [http://empires_public.docs.empiresmod.com/empires_stdlib/vgui/ vgui library] are available for you to use.
Your javascript code is only run once during startup. During this you can register to [[GUI Bindings | bindings]] which call your code if a value you're interested in changes. During that callback you can update your element.

Revision as of 19:19, 17 April 2017

This VGUI element allows you to define its layout using res files and its behavior using javascript.

Attributes

This element inherits all attributes from EditablePanel.

  • src The javascript file to load

Javascript

You can use javascript to add behavior to your element. By default the standard library and vgui library are available for you to use.

Your javascript code is only run once during startup. During this you can register to bindings which call your code if a value you're interested in changes. During that callback you can update your element.