Skip to main content Skills Marktplatz Entdecken und erkunden Sie KI-Skills, die von der Community erstellt wurden.
Mit Codex oder Claude installieren Kopieren Sie diesen Prompt, fügen Sie ihn in Codex, Claude oder einen anderen Assistant ein und lassen Sie die Skill-Seite prüfen und installieren.
Prompt kopierenPrompt-Details anzeigen Ein direkter Befehl überspringt den Prüf-Prompt. Prüfen Sie die Quelle, bevor Sie ihn ausführen.
npx skills add https://github.com/Anhvu1107/all-agent-skill --skill makepad-event-actionDer Befehl bleibt in einer Zeile. Scrollen Sie horizontal, um ihn vor dem Kopieren vollständig zu prüfen.
Sie bevorzugen eine lokale Kopie? Laden Sie die Dateien herunter, die SkillsMP derzeit vorliegen.
ZIP herunterladen Herunterladen... Mehr aus diesem Repository
ALWAYS use this when the user mentions 10 Andruia Skill Smith, asks to build, debug, review, document, automate, test, configure, migrate, or make decisions in this domain, or the task clearly depends on 10 Andruia Skill Smith; scope: Ingeniero de Sistemas de Andru.ia. Apply the bundled workflow, references, scripts, Senior Master standard, and Codex strict review gate before final output.
Verwandte Berufe SOC
Basierend auf der SOC-Berufsklassifikation
name makepad-event-action description ALWAYS use this when the request matches Makepad Event Action: CRITICAL: Use for Makepad event and action handling.
Makepad Event/Action Skill
Selective Reading Rule
Start with:
references/senior-master-standard.md
references/usage-routing.md
references/quality-checklist.md
Then load only the inherited docs, scripts, assets, or examples that match the user's actual task.
Version: makepad-widgets (dev branch) | Last Updated: 2026-01-19
Check for updates: https://crates.io/crates/makepad-widgets
You are an expert at Makepad event and action handling. Help users by:
Handling events : Mouse, keyboard, touch, lifecycle events
Creating actions : Widget-to-parent communication
Event flow : Understanding event propagation
When to Use
You need to handle input, lifecycle, or UI interaction events in Makepad.
The task involves handle_event, Event variants, Hit processing, or widget action propagation.
You need to design or debug Makepad event/action flow between widgets and parents.
Documentation
Refer to the local files for detailed documentation:
./references/event-system.md - Event enum and handling
./references/action-system.md - Action trait and patterns
IMPORTANT: Documentation Completeness Check
Before answering questions, Claude MUST:
Read the relevant reference file(s) listed above
If file read fails or file is empty:
Inform user: "本地文档不完整,建议运行 /sync-crate-skills makepad --force 更新文档"
Still answer based on SKILL.md patterns + built-in knowledge
If reference file exists, incorporate its content into the answer
Event Enum (Key Variants) pub enum Event {
Startup,
Shutdown,
Foreground,
Background,
Resume,
Pause,
Draw (DrawEvent),
LiveEdit,
WindowGotFocus (WindowId),
WindowLostFocus (WindowId),
WindowGeomChange (WindowGeomChangeEvent),
WindowClosed (WindowClosedEvent),
MouseDown (MouseDownEvent),
MouseMove (MouseMoveEvent),
MouseUp (MouseUpEvent),
Scroll (ScrollEvent),
TouchUpdate (TouchUpdateEvent),
KeyDown (KeyEvent),
KeyUp (KeyEvent),
TextInput (TextInputEvent),
TextCopy (TextClipboardEvent),
Timer (TimerEvent),
NextFrame (NextFrameEvent),
HttpResponse (HttpResponse),
Actions (ActionsBuf),
}
Handling Events in Widgets impl Widget for MyWidget {
fn handle_event (&mut self , cx: &mut Cx, event: &Event, scope: &mut Scope) {
match event.hits (cx, self .area ()) {
Hit::FingerDown (fe) => {
cx.action (MyWidgetAction::Pressed);
}
Hit::FingerUp (fe) => {
if fe.is_over {
cx.action (MyWidgetAction::Clicked);
}
}
Hit::FingerHoverIn (_) => {
self .animator_play (cx, id!(hover.on));
}
Hit::FingerHoverOut (_) => {
self .animator_play (cx, id!(hover.off));
}
Hit::KeyDown (ke) => {
if ke.key_code == KeyCode::Return {
cx.action (MyWidgetAction::Submitted);
}
}
_ => {}
}
}
}
Hit Enum pub enum Hit {
FingerDown (FingerDownEvent),
FingerUp (FingerUpEvent),
FingerMove (FingerMoveEvent),
FingerHoverIn (FingerHoverEvent),
FingerHoverOver (FingerHoverEvent),
FingerHoverOut (FingerHoverEvent),
FingerLongPress (FingerLongPressEvent),
KeyDown (KeyEvent),
KeyUp (KeyEvent),
KeyFocus,
KeyFocusLost,
TextInput (TextInputEvent),
TextCopy,
Nothing,
}
Action System
Defining Actions #[derive(Clone, Debug, DefaultNone)]
pub enum ButtonAction {
None ,
Clicked,
Pressed,
Released,
}
Emitting Actions
cx.action (ButtonAction::Clicked);
Cx::post_action (MyAction::DataLoaded (data));
Handling Actions fn handle_event (&mut self , cx: &mut Cx, event: &Event, scope: &mut Scope) {
let actions = cx.capture_actions (|cx| {
self .button.handle_event (cx, event, scope);
});
if self .button (id!(my_button)).clicked (&actions) {
}
for action in actions.iter () {
if let Some (ButtonAction::Clicked) = action.downcast_ref () {
}
}
}
Widget Action Helpers
impl ButtonRef {
fn clicked (&self , actions: &ActionsBuf) -> bool ;
fn pressed (&self , actions: &ActionsBuf) -> bool ;
fn released (&self , actions: &ActionsBuf) -> bool ;
}
impl TextInputRef {
fn changed (&self , actions: &ActionsBuf) -> Option <String >;
fn returned (&self , actions: &ActionsBuf) -> Option <String >;
}
Event Flow
Event arrives from platform layer
Root widget receives event first
Propagates down to children via handle_event
Widgets emit actions via cx.action()
Parent captures actions via cx.capture_actions()
App handles remaining actions
Timer and NextFrame
let timer = cx.start_timer (1.0 );
if let Event ::Timer (te) = event {
if te.timer_id == self .timer {
}
}
let next_frame = cx.new_next_frame ();
if let Event ::NextFrame (ne) = event {
if ne.frame_id == self .next_frame {
}
}
When Answering Questions
Use event.hits(cx, area) to check if event targets a widget
Actions flow UP from child to parent (unlike events which flow DOWN)
Use cx.capture_actions() to intercept child actions
Cx::post_action() is thread-safe for async operations
DefaultNone derive macro auto-implements Default for enums
Limitations
Use this skill only when the task clearly matches the scope described above.
Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.