JFLib
EN
--inspect · Ctrl+Shift+I · F12

Look inside a running app.

The live inspector shows which widget is where, how the layout nests, what each frame repainted and what it cost. In a development build it also changes the look while the app runs and takes you to the line of code that built a widget. It is part of every JFLib app, and closed it costs nothing.

Point, click, know.

Press Pick in the inspector, then click any widget in your app. The click selects instead of acting, and the tool window jumps to the widget: its kind, id, label, rectangle, value, state, layer and window, a selector for your test scripts, and the file and line where your code created it.

The gallery app with the inspector beside it. Pick is pressed, the pointer moves to the radio button Green, the click selects it, and the inspector shows its properties. Then the accent colour changes to orange in the Appearance tab.
The Feature Gallery with its inspector, recorded by a test script.

Three ways to open it.

The inspector lives inside the library, so every app has it without a line of extra code. Nothing is recorded or drawn while it is closed: the frames are byte for byte those of an app without it.

At the start

hello --inspect

Opens the inspector together with the app.

With a key

jfgui_INSPECT=1
# then Ctrl+Shift+I or F12

Arms it, so the hot keys open and close it while you work. You can choose other keys.

From code

ui.inspect_show(true);

For a debug menu in your own app.

An overlay in every window.

The widget under the pointer gets an orange outline and a tag with its kind, id, label, size and state. The selected widget is outlined in blue. The overlay is drawn after your app, outside its draw lists, so your app's repaint regions stay its own.

The overlay naming each widget under the pointer with its id, label, size and state.
Every layout box of the gallery outlined in cyan.
OutlinesEvery layout box, so you see how rows and columns nest.
Purple numbers on every focusable widget, in the order the Tab key visits them.
Tab orderThe Tab stops, numbered in the order the keyboard visits them.
A red rectangle over the Toggle button, the area the last frame repainted.
RepaintsThe rectangles each frame repainted, fading out. A widget that repaints too much shows at once.

A tool window with four tabs.

The inspector's own window never takes the keyboard by itself, and it never shows up in its own tree, overlay or pick. Its selector line copies straight into a test script.

The Widgets tab with the widget tree and the selected widget's properties.
WidgetsThe tree of the current frame inside its layout boxes, and everything about the selected widget.
The Frame tab with passes, build and render times, the repainted area, draw commands, widgets and the glyph cache.
FramePasses, the time to build and to render, the repainted area, draw commands and the glyph cache.
The Colors tab listing every theme token with its colour value.
ColorsEvery theme token with its colour, editable in a development build.
The Appearance tab with style, mode, accent, language, scale, text scale, corner radius, spacing, control height and font.
AppearanceStyle, mode, accent, language, scales, metrics and fonts, while the app runs.

Change the look while it runs.

In a development build, the inspector edits the running app through what already exists: no API to call and no state structure to follow. Try another style, dark mode or high contrast, an accent, a language, a scale, rounder corners or another font, and see it at once.

  • Every change is marked, with its own reset button and a list of old and new values.
  • Undo and redo, also for a whole slider drag as one step.
  • Save your changes as a theme file the app can load.
  • Copy what you changed, as theme lines and as code.
  • Operate clicks, drags, types or sets a value on the selected widget, as input. Your app's own values are never written behind its back.
The gallery with an orange accent colour and rounder corners.
The Appearance tab with two changes: the accent colour E8590C and a corner radius of 8.

From the widget to your code.

The Widgets tab names the file and line where your app built the selected widget. Open in editor starts VS Code, CLion or the editor you name, at that line. A composite widget such as a number box or a menu reports your call, not the library's inner one.

Release builds leave this out completely, so they carry no file paths and run the same code as without the feature. Starting the editor follows your app's permission manifest like any other program it starts.

# the inspector's Widgets tab
Kind      radio
Label     Green
Selector  radio:"Green"
Source    apps/gallery/main.rs:215
          [ Open in editor ]

# your editor, set once
jfgui_EDITOR="code -g {file}:{line}"

Tested like everything else.

The inspector runs headless in .uis test scripts too: open it, pick, select, check the overlay and the selector, edit the look and undo it. A script can even prove that a closed inspector changed nothing at all.

With hot reload, the inspector keeps its tab, options and selection across every rebuild. A failed build keeps the old version running and shows the error at the top of the inspector.

inspect arm
key f12                         # the hot key opens it
inspect pick
click "Standard"                # selects, the app sees nothing
inspect expect selected button:"Standard"
inspect set radius 8
inspect expect changes 1
inspect undo
key f12                         # closed again
inspect expect same              # byte for byte as before
inspect expect idle              # and no work since