CVguiJavascriptContext: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
This [https://developer.valvesoftware.com/wiki/VGUI2 VGUI] element allows you to define its layout using res files and its behavior using javascript. | This [https://developer.valvesoftware.com/wiki/VGUI2 VGUI] element allows you to define its layout using res files and its behavior using javascript. Inherits all properties from [[EditablePanel]]. | ||
== | == Properties == | ||
{{JavascriptContext_Properties}} | |||
{{EditablePanel_Properties}} | |||
{{Panel_Properties}} | |||
* '''src''' The javascript file to load | * '''src''' The javascript file to load | ||
Line 10: | Line 12: | ||
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. | 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. | ||
[[Category:VGUI Elements]] |
Revision as of 05:41, 8 August 2017
This VGUI element allows you to define its layout using res files and its behavior using javascript. Inherits all properties from EditablePanel.
Properties
Template:JavascriptContext Properties
Inherited Properties from EditablePanel
No inherited properties
Properties Inherited from Panel
- fieldName: Determines the name of the control.
- xpos: Determines the horizontal offset from the top left (by default) of the parent panel.
- ypos: Determines the vertical offset from the top left (by default) of the parent panel.
- wide: Determines the width of the control.
- tall: Determines the height of the control.
- zpos: Determines the depth of the panel. Deeper panels are drawn first. Lower numbers = deeper.
- pinCorner: The pinned corner is the one positioned at xpos/ypos. Values are: TOPLEFT (default), TOPRIGHT, BOTTOMLEFT, BOTTOMRIGHT
- pinnedCornerOffsetX:
- pinnedCornerOffsetY:
- unpinnedCornerOffsetX:
- unpinnedCornerOffsetY:
- visible: Determines if the control will be drawn.
- enabled: Determines if the control is enabled. Used by controls higher up the chain (like Buttons).
- ignoreScheme:
- tabPosition: Determines the tab order of the control.
- tooltiptext: Determines the tooltip text to show when you hover over this control.
- paintbackground: Paint the background color of this control.
- paintBackgroundType:
- paintborder: Paint the border of this control.
- autoResize: Sets which edges of the panel can be resized. Values are: 0 (NO, default), 1 (RIGHT), 2 (DOWN), 3 (DOWNANDRIGHT)
- fgcolor_override: Sets the foreground color
- bgcolor_override: Sets the background color
Properties Inherited from Panel
- fieldName: Determines the name of the control.
- xpos: Determines the horizontal offset from the top left (by default) of the parent panel.
- ypos: Determines the vertical offset from the top left (by default) of the parent panel.
- wide: Determines the width of the control.
- tall: Determines the height of the control.
- zpos: Determines the depth of the panel. Deeper panels are drawn first. Lower numbers = deeper.
- pinCorner: The pinned corner is the one positioned at xpos/ypos. Values are: TOPLEFT (default), TOPRIGHT, BOTTOMLEFT, BOTTOMRIGHT
- pinnedCornerOffsetX:
- pinnedCornerOffsetY:
- unpinnedCornerOffsetX:
- unpinnedCornerOffsetY:
- visible: Determines if the control will be drawn.
- enabled: Determines if the control is enabled. Used by controls higher up the chain (like Buttons).
- ignoreScheme:
- tabPosition: Determines the tab order of the control.
- tooltiptext: Determines the tooltip text to show when you hover over this control.
- paintbackground: Paint the background color of this control.
- paintBackgroundType:
- paintborder: Paint the border of this control.
- autoResize: Sets which edges of the panel can be resized. Values are: 0 (NO, default), 1 (RIGHT), 2 (DOWN), 3 (DOWNANDRIGHT)
- fgcolor_override: Sets the foreground color
- bgcolor_override: Sets the background color
- 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.