makepad-2-0-events
하는 일
이 가이드는 Makepad 2.0이 클릭과 입력 같은 사용자 상호작용을 어떻게 처리하는지 설명합니다. 이런 동작을 코드의 함수와 연결해 프로그램이 올바르게 반응하도록 하는 방법을 보여 줍니다.
사용하는 경우
- ✓버튼이 동작을 수행하게 하고 싶을 때.
- ✓텍스트 필드에서 Enter를 누를 때 프로그램이 반응해야 할 때.
- ✓업데이트하거나 삭제할 수 있는 항목 목록을 만들 때.
스킬 링크
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/makepad-2-0-events/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“버튼을 누르면 텍스트 필드의 정보를 저장하게 하려면 어떻게 하나요?”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
Makepad는 이벤트를 처리하는 두 곳을 사용합니다. 하나는 시각 코드 안(Splash)이고, 다른 하나는 더 복잡한 Rust입니다. 직접적인 동작에는 시각 코드가 더 간단하고, 무거운 작업은 Rust가 맡습니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Limitations
- Verify against current Makepad 2.0 docs; upstream APIs change frequently.
- Do not run bundled scripts without explicit user approval.
When to Use
- Use when this upstream workflow matches the user's stated goal.
- Use when the task requires the procedures documented in this skill.
Makepad 2.0 Event & Action System
Overview
Makepad 2.0 uses a two-layer event system:
Splash Layer -- Inline event handlers written directly in
script_mod!Splash code (on_click,on_render,on_return,on_startup). These handle UI interactions declaratively inside the script, close to the widget definitions.Rust Layer -- The
MatchEventtrait withhandle_actions,handle_timer,handle_http_response, etc. These handle business logic, external I/O, and anything that needs full Rust power.
Both layers communicate through two bridge macros:
script_eval!(cx, { ... })-- Execute Splash code from Rust (update state, trigger renders)script_apply_eval!(cx, widget_ref, { ... })-- Patch widget properties from Rust at runtime
1. Splash Inline Event Handlers
Event handlers are attached directly to widgets inside script_mod! blocks. They use
closure syntax with || for no arguments or |arg| for callbacks that receive a value.
on_click -- Button/widget click
Fires when the user clicks a button or clickable widget. No arguments for plain buttons,
or |checked| for CheckBox which passes the new boolean state.
// Plain button click
add_button := Button{
text: "Add"
on_click: ||{
let text = ui.todo_input.text()
if text != "" {
add_todo(text, "")
ui.todo_input.set_text("")
}
}
}
// CheckBox click with checked state argument
check.on_click: |checked| toggle_todo(i, checked)
// Inline delete with closure capturing loop variable
delete.on_click: || delete_todo(i)
// Calling another widget's click programmatically
clear_done := ButtonFlatter{
text: "Clear completed"
on_click: ||{
todos.retain(|todo| !todo.done)
ui.todo_list.render()
}
}
on_render -- Dynamic rendering
Fires when .render() is called on the target view. This is the primary mechanism for
dynamic content. The body replaces the previous draw content of the view.
main_view := View{
width: Fill
height: Fill
on_render: ||{
counter_label := Label{
text: "Count: " + state.counter
draw_text.text_style.font_size: 24
}
}
}
// List rendering with for loop and per-item event handlers
todo_list := ScrollYView{
width: Fill height: Fill
new_batch: true
on_render: ||{
if todos.len() == 0
EmptyState{}
else for i, todo in todos {
TodoItem{
label.text: todo.text
check.active: todo.done
check.on_click: |checked| toggle_todo(i, checked)
delete.on_click: || delete_todo(i)
}
}
}
EmptyState{}
}
Key point: on_render is NOT called automatically. You must call ui.widget_name.render()
to trigger it. The new_batch: true property on a view tells the system to clear previous
draw content before re-rendering.
on_return -- TextInput enter key
Fires when the user presses Enter/Return inside a TextInput. Commonly used to submit forms.
todo_input := TextInput{
width: Fill height: 9. * theme.space_1
empty_text: "What needs to be done?"
on_return: || ui.add_button.on_click()
}
on_startup -- App startup
Fires once when the application starts. Defined at the Root level. Commonly used
to trigger initial renders.
ui: Root{
on_startup: ||{
ui.main_view.render()
}
main_window := Window{
// ...
}
}
Event handler capabilities
Inside event handlers you can:
- Call Splash functions:
add_todo(text, "dev") - Read widget values:
let text = ui.todo_input.text() - Set widget values:
ui.todo_input.set_text("") - Trigger re-renders:
ui.todo_list.render() - Trigger other widget clicks:
ui.add_button.on_click() - Modify state variables:
state.counter += 1 - Use array methods:
todos.push({text: "new", done: false}) - Use control flow:
if text != "" { ... }
2. Rust Event Handling -- MatchEvent Trait
The MatchEvent trait is the Rust-side event dispatcher. It receives platform events
…
자주 묻는 질문
‘이벤트’란 무엇인가요?
마우스 클릭, 키 입력, 프로그램 로딩처럼 일어나는 일입니다.
‘Splash’란 무엇인가요?
Makepad에서 사용자 인터페이스의 모습과 기본 동작을 Rust보다 더 간단하게 설명하는 데 쓰는 언어입니다.
왜 `.render()`를 호출해야 하나요?
Makepad에게 화면의 일부를 다시 그리라고 알리는 것과 같습니다. 사용자가 보는 내용을 새 정보나 변경으로 업데이트합니다.
상세 정보
작성자의 원본 설명
Makepad 2.0 guidance for events; use when building or debugging Makepad UI code.
인기도
- GitHub 스타
- 48k
- 순위
- #5141
- 라이선스
- MIT
- 업데이트
- 2026. 10. 15.
댓글
- …
이 저장소의 다른 스킬
00-andruia-consultant
48k에이전트가 AI 프로젝트를 시작하거나 개선할 수 있도록 코드를 분석하고 스페인어로 실행 계획을 세워 줍니다.
007
48k에이전트가 보안 감사와 위협 모델링을 수행해 공격과 취약점으로부터 프로젝트를 보호하도록 돕습니다.
10-andruia-skill-smith
48k에이전트가 AI 도구의 작동 방식을 정의하고 문서를 쓰며 구조를 검증하도록 돕습니다.
20-andruia-niche-intelligence
48k에이전트가 신뢰할 수 있는 자료를 바탕으로 특정 산업의 맥락, 규칙, 사용 패턴, 위험을 정리한 요약을 만들도록 돕습니다.
비슷한 스킬
angular-developer
280k에이전트가 Angular 코드를 만들고 프로젝트 구조를 조언하도록 돕습니다. 새 프로젝트 시작, 코드 부분 생성, 성능과 접근성 개선에 유용합니다.
frontend-a11y
280k모든 사람이 웹 인터페이스를 쓸 수 있도록 에이전트를 돕습니다. 웹사이트와 앱이 화면 읽기 프로그램과 키보드 탐색에서 잘 작동하도록 합니다.
frontend-patterns
280k프론트엔드 개발의 현대적인 패턴을 적용하도록 에이전트를 돕습니다. React와 Next.js에서 성능을 최적화하고, 상태를 관리하며, 모범 사례를 따릅니다.