API ReferenceGE Extensionsflowgraphnodesuiimguielemental
ImGui Button
- **Node Name:** `im Button`
Overview
- Node Name:
im Button - Category:
repeat_instant - File:
extensions/flowgraph/nodes/ui/imgui/elemental/imButton.lua
Displays a button in an ImGui window. Provides separate output flows for click, hold, and release events.
Pin Schema
Input Pins
| Pin | Type | Description |
|---|---|---|
text | any | Text displayed on the button |
Output Pins
| Pin | Type | Description |
|---|---|---|
down | flow (impulse) | Fires when button is clicked |
hold | flow | When button is held down (hidden) |
up | flow | When button is released (hidden) |
Internals
Key Methods
| Method | Description |
|---|---|
work() | Draws button at full content width, checks mouse interaction states |
_executionStarted() | Resets all output pins to false |
Mouse State Logic
The node checks three mutually exclusive mouse states when the button is hovered:
| State | Condition |
|---|---|
down | im.IsMouseClicked(0) - first frame of press |
hold | im.IsMouseDown(0) - sustained press |
up | im.IsMouseReleased(0) - release frame |
Only one state is true at a time. When not hovered, all outputs are false.
How It Works
- Draws an ImGui button at full available width using
im.GetContentRegionAvail(). - Checks if the button is hovered via
im.IsItemHovered(). - When hovered, determines which mouse state applies and sets the corresponding output.
- The
downoutput is an impulse (true for one frame on click).
Usage Example
-- Flowgraph chain:
-- [im Begin] → [im Button (text="Start")] → (down) → [Start Race]
-- → (hold) → [Show Countdown]
-- Under the hood:
local avail = im.GetContentRegionAvail()
im.Button("Start##42", im.ImVec2(avail.x, 0))Key Dependencies
ui_imgui- ImGui bindings (Button,IsItemHovered,IsMouseClicked, etc.)
See Also
- im Begin (Flowgraph Node) - Related reference
- im Checkbox (Flowgraph Node) - Related reference
- im Color (Flowgraph Node) - Related reference
- FlowGraph Guide - Guide