mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-12-02 03:58:33 +08:00
improve builtin dialogs
This commit is contained in:
parent
ac1eb03607
commit
d87ca8eef2
@ -1,5 +1,9 @@
|
||||
# 最新动态
|
||||
|
||||
* 2019/12/17
|
||||
* 完善dialog\_confirm/dialog\_info等函数。
|
||||
* 增加widget\_set\_focusable函数。
|
||||
|
||||
* 2019/12/13
|
||||
* 修改窗口切到FOREGROUND把焦点设回去会导致如果当前页面有滚动控件时,页面会滚动的问题(感谢大恒提供补丁)。
|
||||
* 修改widget在point_down少发了个leave事件的问题(感谢大恒提供补丁)。
|
||||
|
@ -99,7 +99,9 @@ static widget_t* dialog_create_label(const char* text) {
|
||||
label = label_create(NULL, 0, 0, 0, 0);
|
||||
return_value_if_fail(label != NULL, NULL);
|
||||
|
||||
widget_set_tr_text(label, text);
|
||||
if (text != NULL) {
|
||||
widget_set_tr_text(label, text);
|
||||
}
|
||||
label_resize_to_content(label, r.x, r.w, r.y, r.h);
|
||||
|
||||
return label;
|
||||
@ -161,6 +163,8 @@ ret_t dialog_info_ex(const char* text, const char* title_text, const char* theme
|
||||
|
||||
ok = button_create(client, 0, 0, 0, 0);
|
||||
widget_set_tr_text(ok, "OK");
|
||||
widget_set_focused(ok, TRUE);
|
||||
widget_set_focusable(ok, TRUE);
|
||||
widget_set_self_layout(ok, "default(x=c, y=bottom:10, w=50%, h=30)");
|
||||
widget_on(ok, EVT_CLICK, on_ok_to_quit, dialog);
|
||||
|
||||
@ -218,11 +222,14 @@ ret_t dialog_confirm(const char* stitle, const char* text) {
|
||||
|
||||
ok = button_create(client, 0, 0, 0, 0);
|
||||
widget_set_tr_text(ok, "OK");
|
||||
widget_set_focused(ok, TRUE);
|
||||
widget_set_focusable(ok, TRUE);
|
||||
widget_use_style(ok, OK_STYLE_NAME);
|
||||
widget_set_self_layout(ok, "default(x=10%, y=bottom:10, w=30%, h=30)");
|
||||
widget_on(ok, EVT_CLICK, on_ok_to_quit, dialog);
|
||||
|
||||
cancel = button_create(client, 0, 0, 0, 0);
|
||||
widget_set_focusable(cancel, TRUE);
|
||||
widget_set_tr_text(cancel, "Cancel");
|
||||
widget_use_style(cancel, CANCEL_STYLE_NAME);
|
||||
widget_set_self_layout(cancel, "default(x=r:10%, y=bottom:10, w=30%, h=30)");
|
||||
|
Loading…
Reference in New Issue
Block a user