Kaynağa Gözat

update: easylvgl, 优化消息框回调部分

zengeshuai 3 ay önce
ebeveyn
işleme
617ffe023c

+ 4 - 1
components/easylvgl/src/components/base/luat_easylvgl_event.c

@@ -7,11 +7,14 @@
 #include "luat_easylvgl_component.h"
 #include "lua.h"
 #include "lauxlib.h"
+#include "../../inc/luat_easylvgl_binding.h"
 #include "lvgl9/src/widgets/button/lv_button.h"
 #include "lvgl9/src/widgets/dropdown/lv_dropdown.h"
 #include "lvgl9/src/misc/lv_event.h"
 #include <string.h>
 
+#define EASYLVGL_MSGBOX_MT "easylvgl.msgbox"
+
 /**
  * 捕获配置表中的回调函数
  * @param L Lua 状态
@@ -238,7 +241,7 @@ void easylvgl_component_call_action_callback(
     lua_rawgeti(L_state, LUA_REGISTRYINDEX, callback_ref);
 
     if (lua_type(L_state, -1) == LUA_TFUNCTION) {
-        lua_pushlightuserdata(L_state, meta->obj);
+        easylvgl_push_component_userdata(L_state, meta->obj, EASYLVGL_MSGBOX_MT);
         lua_pushstring(L_state, action_text != NULL ? action_text : "");
 
         if (lua_pcall(L_state, 2, 0, 0) != LUA_OK) {