InstPressureGauge
InstPressureGauge is an instrumentation widget in the “Instrumentation” section, built from the Instrument archetype (kind “PressureGauge”). An instrumentation gauge or meter: a needle, dial, bar, or digital readout showing one live value in a range, with programmable level, limits, and alarms.
Category: Instrumentation Family: Inst Section: Instrumentation Archetype: Instrument Kind: PressureGauge Default size: 200×90

Properties
| Property | Type | Default | Rust setter |
|---|---|---|---|
background | Color | — | set_style_name |
foreground | Color | — | set_style_name |
tooltip-text | Str | — | — |
visible | Bool | true | set_visible |
enabled | Bool | true | set_enabled |
“—” in the setter column means the Rust widget code has no setter for that property: it is set in the designer (Inspector) and carried in the saved design, not changed from Rust code.
Instrument archetype settings (Rust)
Settings on the shared Instrument struct in crates/xframe-widgets/src/archetypes.rs. One struct serves every kind of the archetype, so only the settings matching this kind apply to it (a calendar uses set_date, a notebook uses the tab settings, a grid uses the grid settings). “—” as a default means the data gives no Inspector default for that setting.
| Property | Type | Default | Rust setter |
|---|---|---|---|
white-color | Color | — | set_white_color |
face-color | Color | — | set_face_color |
ink-color | Color | — | set_ink_color |
red-color | Color | — | set_red_color |
amber-color | Color | — | set_amber_color |
green-color | Color | — | set_green_color |
blue-color | Color | — | set_blue_color |
dark-color | Color | — | set_dark_color |
lead-color | Color | — | set_lead_color |
bezel-color | Color | — | set_bezel_color |
ring-color | Color | — | set_ring_color |
outline-color | Color | — | set_outline_color |
panel-color | Color | — | set_panel_color |
tick-color | Color | — | set_tick_color |
needle-color | Color | — | set_needle_color |
pale-color | Color | — | set_pale_color |
fill-color | Color | — | set_fill_color |
grid-color | Color | — | set_grid_color |
hover-color | Color | — | set_hover_color |
beacon-color | Color | — | set_beacon_color |
steel-color | Color | — | set_steel_color |
surface-color | Color | — | set_surface_color |
seg-bg-color | Color | — | set_seg_bg_color |
seg-bezel-color | Color | — | set_seg_bezel_color |
seg-label-color | Color | — | set_seg_label_color |
seg7-lit-color | Color | — | set_seg7_lit_color |
seg7-dim-color | Color | — | set_seg7_dim_color |
seg14-lit-color | Color | — | set_seg14_lit_color |
seg14-dim-color | Color | — | set_seg14_dim_color |
seg16-lit-color | Color | — | set_seg16_lit_color |
seg16-dim-color | Color | — | set_seg16_dim_color |
segment-on-color | Color | — | set_segment_on_color |
segment-off-color | Color | — | set_segment_off_color |
led-color | Color | — | set_led_color |
lamp-color | Color | — | set_lamp_color |
stack-red-color | Color | — | set_stack_red_color |
stack-amber-color | Color | — | set_stack_amber_color |
stack-green-color | Color | — | set_stack_green_color |
red-channel-color | Color | — | set_red_channel_color |
green-channel-color | Color | — | set_green_channel_color |
blue-channel-color | Color | — | set_blue_channel_color |
on | Bool | — | set_on |
stack-red-on | Bool | — | set_stack_red_on |
stack-amber-on | Bool | — | set_stack_amber_on |
stack-green-on | Bool | — | set_stack_green_on |
red-on | Bool | — | set_red_on |
green-on | Bool | — | set_green_on |
blue-on | Bool | — | set_blue_on |
needle-line-width | Int | — | set_needle_line_width |
marker-line-width | Int | — | set_marker_line_width |
unit | Str | — | set_unit |
display-text | Str | — | set_display_text |
Working example
Minimal complete Rust program — this is the file examples/InstPressureGauge.rs in lightgui_rust. Run it with:
cargo run -p xframe-demo --example InstPressureGauge//! InstPressureGauge — minimal complete XFrame example.
//!
//! Run it from the workspace root:
//! cargo run -p xframe-demo --example InstPressureGauge
//! It opens an 800x600 window showing one InstPressureGauge widget (press Esc
//! or `q`, or close the window, to quit). The widget is the real
//! `xframe-widgets` implementation for this registry kind, created by
//! `xframe_widgets::create("InstPressureGauge")` inside `xframe_demo::run_widget`
//! — the same code path the `xframe-demo` binary uses.
use std::process::ExitCode;
fn main() -> ExitCode {
match xframe_demo::run_widget("InstPressureGauge", false, None, None) {
Ok(code) => ExitCode::from(code as u8),
Err(e) => {
eprintln!("InstPressureGauge example: {}", e);
ExitCode::from(1)
}
}
}
Event handling
Every XFrame widget dispatches the same four input events through the Widget trait: button press, button release, pointer motion, and key press. The generated event loop routes a release to the widget that got the press (even if the pointer moved off it), motion to the pressed widget while dragging and otherwise to the topmost widget under the pointer, and keys only to the focused widget. A press that starts and ends inside an enabled widget fires its click handler (on_click); Return or Space fires it when the widget is focused.
This kind has no named signal of its own in the event tables: it uses the generic press / release / motion / key dispatch above, and its click handler where the archetype provides one.
Gauges: adjusting the level
A gauge shows one live value. Set its range first with set_range(min, max), then move the needle/bar/readout with set_value(level) — the widget redraws at the new level. set_step() controls the keyboard/step increment. Read the current level back with value(), and the limits with min() / max(). Drive it from a timer or data feed: set the value, then redraw.
Styling: colours, border radius, line width, line colour
Styling is per-style, not per-widget: a Style carries fill_color, outline_color, line_color, text_color, radius (border radius), line_width, and font_name. Register a style with add_style_ex (argument order: fill, outline, text, line, radius, line width, font) and apply it with set_style_name("name") on any widget — the same widget can be square or rounded, thin- or thick-lined, just by switching style. The demo's default style uses radius 6 and line width 1; dark is the dark variant.