API ReferenceGE Extensionsflowgraphnodesui
Custom Button TEST (Flowgraph Node)
- **Node Name:** `Custom Button TEST`
Overview
- Node Name:
Custom Button TEST - Category:
once_instant - File:
extensions/flowgraph/nodes/ui/customButtonTEST.lua - Status: TEST node - experimental/example
Demonstrates how to create custom UI buttons that trigger flowgraph actions via guihooks and core_flowgraphManager callbacks.
Pin Schema
Output Pins
| Pin | Type | Description |
|---|---|---|
btn_1 | flow | Fires once when the button is pressed |
Dependencies
core_input_bindings
How It Works
_executionStarted()- Setsopen = false.workOnce()- Sends button data to the UI viaguihooks.trigger('CustomFGButtons', data).- Each button entry contains a
nameand afunstring - a Lua command that calls back into the node:core_flowgraphManager.getManagerByID(mgrId).graphs[graphId].nodes[nodeId]:buttonPushed("btn_1") buttonPushed(action)- Sets the matching output pin totrueand all others tofalse._executionStopped()/onNodeReset()- Closes the dialogue by sending an empty button list.closeDialogue()- Triggersguihooks.trigger('CustomFGButtons', {})to hide all custom buttons.
Callback Pattern
The key pattern here is generating a Lua command string that the UI can execute to call back into a specific flowgraph node:
function C:getCmd(action)
return 'core_flowgraphManager.getManagerByID('..self.mgr.id
..').graphs['..self.graph.id
..'].nodes['..self.id
..']:buttonPushed("'..action..'")'
endExample Usage
-- This is a test/example node showing the custom button pattern.
-- For production use, prefer the simpleButton or createButton nodes.
-- The pattern is useful when you need fully custom UI button behavior.
guihooks.trigger('CustomFGButtons', {
{ name = "Click me!", fun = callbackCommand }
})Previously Undocumented (Added by Audit)
C:openDialogue()- Function handling openDialogue logic
See Also
- Medal / Auto Medal (Flowgraph Node) - Related reference
- Clear Messages (Flowgraph Node) - Related reference
- Context Translation (Flowgraph Node) - Related reference
- FlowGraph Guide - Guide