diff --git a/docs/changes.md b/docs/changes.md index 3b9789c70..9ae9e4b0b 100644 --- a/docs/changes.md +++ b/docs/changes.md @@ -2,6 +2,7 @@ 2025/01/27 * 事件名支持 anim_start/anim_once/anim_end + * widget_clone 触发 EVT_WIDGET_LOAD 事件。 2025/01/21 * 调整打包工具参数顺序,兼容原来打包工具的使用方式(感谢培煌提供补丁) diff --git a/src/base/widget.c b/src/base/widget.c index 64af49ac9..e4f80f5d0 100644 --- a/src/base/widget.c +++ b/src/base/widget.c @@ -3957,8 +3957,11 @@ widget_t* widget_clone(widget_t* widget, widget_t* parent) { clone = widget->vt->create(parent, widget->x, widget->y, widget->w, widget->h); return_value_if_fail(clone != NULL, NULL); + clone->loading = TRUE; widget_copy(clone, widget); - + widget_dispatch_simple_event(widget, EVT_WIDGET_LOAD); + clone->loading = FALSE; + WIDGET_FOR_EACH_CHILD_BEGIN(widget, iter, i) if (iter->auto_created != TRUE) { widget_clone(iter, clone);