makepad-2.0-events

Implement event and action handling for Makepad 2.0 cross-platform UI applications.

747|87|Updated Jan 10, 2026
One-click install
npx skills add https://github.com/ZhangHanDong/makepad-skills --skill makepad-2-0-events
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: makepad-2.0-events
Source: https://github.com/ZhangHanDong/makepad-skills/tree/main/skills/makepad-2.0-events
Command: npx skills add https://github.com/ZhangHanDong/makepad-skills --skill makepad-2-0-events

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Wiring up user interactions in Makepad 2.0 requires understanding its two-layer event system: Splash inline handlers (on_click, on_render, on_return) and the Rust MatchEvent trait, plus the bridge macros connecting them. This Skill provides the complete patterns, APIs, and working examples so you don't have to reverse-engineer the framework source.

Core Features & Use Cases

  • Splash Inline Handlers: Attach on_click, on_render, on_return, and on_startup handlers directly in script_mod! code, including per-item closures in dynamic lists.
  • Rust MatchEvent Trait: Handle widget actions, timers, HTTP responses, keyboard input, and lifecycle events with the full handle_actions API for Button, TextInput, CheckBox, DropDown, Slider, and RadioButton.
  • Rust-to-Splash Bridges: Use script_eval! to update Splash state and trigger re-renders, and script_apply_eval! to patch widget properties at runtime with #(expr) value interpolation.
  • Use Case: Build a todo app where a TextInput's on_return submits a new item, a ScrollYView re-renders the list with per-item delete buttons, and a Rust-side timer polls a remote API whose HTTP response updates the UI via script_eval!.

Quick Start

Ask the AI to build a Makepad 2.0 counter app where clicking a button increments a counter and re-renders the label, using handle_actions and script_eval!.

Frequently Asked Questions about makepad-2.0-events

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I handle button clicks in Makepad 2.0?

Use either a Splash inline handler with on_click: ||{ ... } directly in script_mod!, or handle it in Rust via handle_actions by calling self.ui.button(cx, ids!(my_button)).clicked(actions). Splash handlers suit UI-level logic; Rust handlers suit business logic and I/O.

How do I update Makepad UI from Rust code?

Use the script_eval!(cx, { ... }) macro to execute Splash code from Rust, updating mod.state variables and calling ui.view_name.render() to trigger re-renders. Inject Rust values into Splash with the #(expr) interpolation syntax.

Why is my Makepad on_render handler not being called?

on_render is not invoked automatically; you must explicitly call ui.widget_name.render() to trigger it. Also set new_batch: true on the view if you want previous draw content cleared before re-rendering.

Does Makepad 2.0 support HTTP requests and async responses?

Yes. Rust code fires requests with cx.http_request(request_id, req) and receives results in handle_http_response, handle_http_request_error, and handle_http_progress. Splash also supports net.http_request with on_response, on_error, and streaming on_stream callbacks.

How do I handle keyboard shortcuts in a Makepad app?

Implement handle_key_down in the MatchEvent trait and match on event.key_code with event.modifiers for combinations like Ctrl+S. For widget-level keys, match Hit::KeyDown inside a custom widget's handle_event using event.hits(cx, area).

Why don't my Splash button clicks reach handle_actions in Rust?

Dynamically created Splash buttons have unstable UIDs, so the uid_map may not rebuild in time for Rust-side action queries. Always use on_click handlers inside Splash for these buttons instead of relying on handle_actions.