Difference between revisions of "SetOnMenuClickEventHandler"

From the Fallout3 GECK Wiki
Jump to navigation Jump to search
imported>Jazzisparis
(Created page with "{{Function |origin = JIP |summary = Sets/removes the specified '''UDF Script''' as a handler that will be invoked in the event the specified '''UI Element''' is clicked/pres...")
 
imported>Jazzisparis
 
(One intermediate revision by the same user not shown)
Line 5: Line 5:
The '''elementPath''' argument may be the full-path of an element, as:
The '''elementPath''' argument may be the full-path of an element, as:
<pre>"InventoryMenu/GLOW_BRANCH/IM_Tabline/Apparel"
<pre>"InventoryMenu/GLOW_BRANCH/IM_Tabline/Apparel"
InventoryMenu/GLOW_BRANCH/IM_Tabline/Weapons
"InventoryMenu/GLOW_BRANCH/IM_Tabline/Weapons"
InventoryMenu/GLOW_BRANCH/IM_Tabline/Aid</pre>
"InventoryMenu/GLOW_BRANCH/IM_Tabline/Aid"</pre>
In which case the handler will be invoked only when the specific element is clicked.
In which case the handler will be invoked only when the specific element is clicked.


Line 19: Line 19:
*'''(int) Menu Mode ID''' - 1002/1009/1075 etc.
*'''(int) Menu Mode ID''' - 1002/1009/1075 etc.
*'''(int) Element ID''' - Only for elements with a <id> property. Otherwise -1 is passed.
*'''(int) Element ID''' - Only for elements with a <id> property. Otherwise -1 is passed.
*'''(string_var) Element Name''' - Without the full path (for example: "Apparel"). For template ListBox elements, the name is suffixed with the element's index in the list (for example: "stats_list_template_item:26")
*'''(string_var) Element Name''' - Without the full-path, and <u>in lower-case</u> (for example: "apparel"). For template ListBox elements, the name is suffixed with the element's index in the list (for example: "stats_list_template_item:26")
  |name = SetOnMenuClickEventHandler
  |name = SetOnMenuClickEventHandler
  |arguments =  
  |arguments =  

Latest revision as of 21:55, 29 January 2017

< [[::Category:Functions|Category:Functions]]

A function added by the JIP NVSE Plugin.

Description

Sets/removes the specified UDF Script as a handler that will be invoked in the event the specified UI Element is clicked/pressed.

The elementPath argument may be the full-path of an element, as:

"InventoryMenu/GLOW_BRANCH/IM_Tabline/Apparel"
"InventoryMenu/GLOW_BRANCH/IM_Tabline/Weapons"
"InventoryMenu/GLOW_BRANCH/IM_Tabline/Aid"

In which case the handler will be invoked only when the specific element is clicked.

It may be a partial path, as:

"InventoryMenu/GLOW_BRANCH/IM_Tabline"

In which case the handler will be invoked when ANY element beginning with that path is clicked.

Note that the path, either full or partial, must begin with a valid menu name.


When invoked, the script is passed with three arguments:

  • (int) Menu Mode ID - 1002/1009/1075 etc.
  • (int) Element ID - Only for elements with a <id> property. Otherwise -1 is passed.
  • (string_var) Element Name - Without the full-path, and in lower-case (for example: "apparel"). For template ListBox elements, the name is suffixed with the element's index in the list (for example: "stats_list_template_item:26")

Syntax

[help]
SetOnMenuClickEventHandler handlerScript:ref setORremove:1/0 elementPath:string

Example

SetOnMenuClickEventHandler OnMenuClickUDF 1 "ContainerMenu/NOGLOW_BRANCH/CM_ButtonRect/CM_ExitButton"

Sets the OnMenuClickUDF script as a handler to be invoked when any UI Element(s) matching the string is clicked.

SetOnMenuClickEventHandler OnMenuClickUDF 0 "ContainerMenu/NOGLOW_BRANCH/CM_ButtonRect/CM_ExitButton"

Removes the OnMenuClickUDF script as a handler of the above.

Handler Script

A skeleton handler script for this event:

scn	OnMenuClickUDF

int	iMenuID
int	iElementID
string_var	sElementName

begin Function {iMenuID, iElementID, sElementName}

	(code)

	sv_Destruct sElementName

end

See Also