summaryrefslogtreecommitdiff
path: root/components/rtgui/widgets
diff options
context:
space:
mode:
authorbernard.xiong <[email protected]>2011-08-17 08:23:59 +0000
committerbernard.xiong <[email protected]>2011-08-17 08:23:59 +0000
commite1e75c4572cb1e1971d5c636e582d6608ca4aa22 (patch)
treec67b70f80950916480c3f88583dac19136f2ae59 /components/rtgui/widgets
parentc834d7cdbdde6b28cbc13dc9cfca1456b2d317cb (diff)
fixed Chinese font issue; fixed keyboard event handler issue in list widgets.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1673 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'components/rtgui/widgets')
-rw-r--r--components/rtgui/widgets/list_view.c16
-rw-r--r--components/rtgui/widgets/listbox.c13
2 files changed, 28 insertions, 1 deletions
diff --git a/components/rtgui/widgets/list_view.c b/components/rtgui/widgets/list_view.c
index 44cfcdf113..bc88062b87 100644
--- a/components/rtgui/widgets/list_view.c
+++ b/components/rtgui/widgets/list_view.c
@@ -456,6 +456,22 @@ rt_bool_t rtgui_list_view_event_handler(struct rtgui_widget* widget, struct rtgu
{
rt_uint16_t old_item;
+ if (view->current_item == -1)
+ {
+ /* set a initial item */
+ if ((view->items_count > 0) &&
+ (ekbd->key == RTGUIK_UP || ekbd->key == RTGUIK_DOWN))
+ {
+ view->current_item = 0;
+ if (view->flag == RTGUI_LIST_VIEW_LIST)
+ rtgui_list_view_update_list(view, -1);
+ else
+ rtgui_list_view_update_icon(view, -1);
+ break;
+ }
+ else return RT_FALSE;
+ }
+
old_item = view->current_item;
switch (ekbd->key)
{
diff --git a/components/rtgui/widgets/listbox.c b/components/rtgui/widgets/listbox.c
index f68ec02efe..0ce5aebe32 100644
--- a/components/rtgui/widgets/listbox.c
+++ b/components/rtgui/widgets/listbox.c
@@ -266,7 +266,18 @@ rt_bool_t rtgui_listbox_event_handler(struct rtgui_widget* widget, struct rtgui_
{
rt_int16_t old_item;
- if (box->current_item == -1) return RT_FALSE;
+ if (box->current_item == -1)
+ {
+ /* set a initial item */
+ if ((box->items_count > 0) &&
+ (ekbd->key == RTGUIK_UP || ekbd->key == RTGUIK_DOWN))
+ {
+ box->current_item = 0;
+ rtgui_listbox_update_current(box, -1);
+ break;
+ }
+ else return RT_FALSE;
+ }
old_item = box->current_item;
switch (ekbd->key)