提交 523980b4 编写于 作者: B bernard.xiong@gmail.com

fix not deleting timer when auto window has been closed.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1041 bbd45198-f89e-11dd-88c7-29a3b14d5316
上级 dda2cd72
......@@ -61,6 +61,21 @@ void diag_close(struct rtgui_timer* timer, void* parameter)
}
}
/* AUTO窗口关闭时的事件处理 */
rt_bool_t auto_window_close(struct rtgui_widget* widget, struct rtgui_event* event)
{
if (timer != RT_NULL)
{
/* 停止并删除定时器 */
rtgui_timer_stop(timer);
rtgui_timer_destory(timer);
timer = RT_NULL;
}
return RT_TRUE;
}
static rt_uint16_t delta_x = 20;
static rt_uint16_t delta_y = 40;
......@@ -115,6 +130,9 @@ static void demo_autowin_onbutton(struct rtgui_widget* widget, rtgui_event_t* ev
rtgui_widget_set_rect(RTGUI_WIDGET(label), &rect);
rtgui_container_add_child(RTGUI_CONTAINER(msgbox), RTGUI_WIDGET(label));
/* 设置关闭窗口时的动作 */
rtgui_win_set_onclose(msgbox, auto_window_close);
rtgui_win_show(msgbox, RT_FALSE);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册