slint-ui/slint · error

ItemMemberFunctionCall `{prop_name}`

Error message

ItemMemberFunctionCall `{prop_name}`

What it means

In the interpreter (used by slint-viewer, the LSP live preview, slintpad and the dynamic APIs), calling a member function on an item is evaluated by eval.rs, which implements only WindowItem.hide() and WindowItem.close(). Any other item member-function call in the markup reaches `unimplemented!("ItemMemberFunctionCall `{prop_name}`")` and panics at evaluation time.

Source

Thrown at internal/interpreter/eval.rs:2688

        );
    }
    if let Some(menu) = vtable::VRef::downcast_pin::<ContextMenu>(item_rc.borrow()) {
        dispatch!(menu, prop_name.as_str();
            "close" => close => (),
            "is-open" => is_open,
        );
    }
    if let Some(window) = vtable::VRef::downcast_pin::<WindowItem>(item_rc.borrow()) {
        match prop_name.as_str() {
            "hide" => {
                window.hide(&adapter, &item_rc);
                return Value::Void;
            }
            "close" => return Value::Bool(window.close(&adapter, &item_rc)),
            _ => {}
        }
    }
    unimplemented!("ItemMemberFunctionCall `{prop_name}`")
}

View on GitHub (pinned to a9ea814a58)

Solutions

  1. Restrict member-function calls to `window.hide()` / `window.close()` in markup that must run under the interpreter.
  2. Verify behavior in a compiled build (Rust/cargo build of the app) instead of the interpreter preview.
  3. Update slint-viewer / VS Code extension / slintpad to the version whose interpreter implements that member function.
  4. If missing on the latest release, report it upstream with the prop_name from the panic.
Defensive patterns

Strategy: fallback

Validate before calling

# Lint: interpreter contexts support only window hide/close member calls
import re, sys
allowed = {"hide", "close"}
for path in sys.argv[1:]:
    for m in re.finditer(r"\b([A-Za-z_][\w-]*)\s*\.\s*(\w+)\s*\(", open(path).read()):
        obj, fn = m.groups()
        if fn in {"focus", "grab_focus"} or (fn in allowed and obj not in {"root", "window"} and fn not in allowed):
            print(f"{path}: member function '{obj}.{fn}()' may be unsupported by the interpreter")

Prevention

When it happens

Trigger: A .slint file invoking an item member function other than window hide/close — e.g. focus()/grab-focus-style calls on input items — while running through an interpreter-based tool (slint-viewer path/to/file.slint, VS Code preview, slintpad, or load_str from Python/Node).

Common situations: Markup written for a newer Slint release using new member functions, previewed with an older viewer/LSP; using interpreter contexts to test UI that relies on member functions only the compiled code path supports.

Related errors


AI-assisted analysis of slint-ui/slint@a9ea814a58 (2026-08-16). Data as JSON: /api/errors/58f3004e97eb4120. Report an issue: GitHub.