diff --git a/components/rtgui/widgets/menu.c b/components/rtgui/widgets/menu.c index 215a426cbb..672fe9ba22 100644 --- a/components/rtgui/widgets/menu.c +++ b/components/rtgui/widgets/menu.c @@ -49,7 +49,7 @@ static void _rtgui_menu_onitem(struct rtgui_widget* widget, struct rtgui_event* rt_uint16_t count; rtgui_rect_t item_rect; - items = menu->items[menu->items_list->current_item].submenu; + items = (rtgui_menu_item_t*)menu->items[menu->items_list->current_item].submenu; count = menu->items[menu->items_list->current_item].submenu_count; if (menu->sub_menu != RT_NULL) { @@ -164,7 +164,7 @@ static rt_bool_t rtgui_menu_on_deactivate(rtgui_widget_t* widget, rtgui_event_t* { /* whether click on parent menu */ if (rtgui_win_is_activated(RTGUI_WIN(menu->parent_menu)) == RT_TRUE && - menu->parent_menu->items[menu->parent_menu->items_list->current_item].submenu == menu->items) + menu->parent_menu->items[menu->parent_menu->items_list->current_item].submenu == (struct rtgui_menu_item_t *)menu->items) return RT_TRUE; } diff --git a/examples/gui/demo_view_menu.c b/examples/gui/demo_view_menu.c index c0dabbb8df..168a797142 100644 --- a/examples/gui/demo_view_menu.c +++ b/examples/gui/demo_view_menu.c @@ -25,7 +25,7 @@ static const rtgui_menu_item_t items[] = {RTGUI_ITEM_NORMAL, "item #1", RT_NULL, RT_NULL, 0, RT_NULL}, {RTGUI_ITEM_NORMAL, "item #2", RT_NULL, RT_NULL, 0, RT_NULL}, {RTGUI_ITEM_SEPARATOR, RT_NULL, RT_NULL, RT_NULL, 0, RT_NULL}, - {RTGUI_ITEM_SUBMENU, "item #3", RT_NULL, sub_items, sizeof(sub_items)/sizeof(sub_items[0]), RT_NULL}, + {RTGUI_ITEM_SUBMENU, "item #3", RT_NULL, (struct rtgui_menu_item_t *)sub_items, sizeof(sub_items)/sizeof(sub_items[0]), RT_NULL}, }; static rtgui_menu_t* menu;