SetOnMenuClickEventHandler

From the Fallout3 GECK Wiki
Jump to navigation Jump to search
< [[::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