check_button_t

概述

image

勾选按钮控件(单选/多选)。

check_button_t是widget_t的子类控件,widget_t的函数均适用于check_button_t控件。

在xml中使用”check_button”标签创建多选按钮控件。如:

  1. <check_button name="c1" text="Book"/>

在xml中使用”radio_button”标签创建单选按钮控件。如:

  1. <radio_button name="r1" text="Book"/>

更多用法请参考:
button.xml

在c代码中使用函数check_button_create创建多选按钮控件。如:

  1. widget_t* button = check_button_create(win, x, y, w, h);
  2. widget_set_text(button, L"OK");
  3. widget_on(button, EVT_VALUE_CHANGED, on_changed, NULL);

在c代码中使用函数check_button_create_radio创建单选按钮控件。如:

  1. widget_t* button = check_button_create_radio(win, x, y, w, h);
  2. widget_set_text(button, L"OK");
  3. widget_on(button, EVT_VALUE_CHANGED, on_changed, NULL);

完整示例请参考:
button demo

可用通过style来设置控件的显示风格,如字体的大小和颜色等等。如:

  1. <style name="default" icon_at="left">
  2. <normal icon="unchecked" />
  3. <pressed icon="unchecked" />
  4. <over icon="unchecked" text_color="green"/>
  5. <normal_of_checked icon="checked" text_color="blue"/>
  6. <pressed_of_checked icon="checked" text_color="blue"/>
  7. <over_of_checked icon="checked" text_color="green"/>
  8. </style>

更多用法请参考:
theme
default


函数

函数名称 说明
check_button_cast 转换check_button对象(供脚本语言使用)。
check_button_create 创建多选按钮对象
check_button_create_radio 创建单选按钮对象
check_button_set_value 设置控件的值。

属性

属性名称 类型 说明
value bool_t 值。

事件

事件名称 类型 说明
EVT_VALUE_WILL_CHANGE event_t 值(勾选状态)即将改变事件。
EVT_VALUE_CHANGED event_t 值(勾选状态)改变事件。

check_button_cast 函数


  • 函数功能:

转换check_button对象(供脚本语言使用)。

  • 函数原型:
  1. widget_t* check_button_cast (widget_t* widget);
  • 参数说明:
参数 类型 说明
返回值 widget_t* check_button对象。
widget widget_t* check_button对象。

check_button_create 函数


  • 函数功能:

创建多选按钮对象

  • 函数原型:
  1. widget_t* check_button_create (widget_t* parent, xy_t x, xy_t y, wh_t w, wh_t h);
  • 参数说明:
参数 类型 说明
返回值 widget_t* 对象。
parent widget_t* 父控件
x xy_t x坐标
y xy_t y坐标
w wh_t 宽度
h wh_t 高度

check_button_create_radio 函数


  • 函数功能:

创建单选按钮对象

  • 函数原型:
  1. widget_t* check_button_create_radio (widget_t* parent, xy_t x, xy_t y, wh_t w, wh_t h);
  • 参数说明:
参数 类型 说明
返回值 widget_t* 对象。
parent widget_t* 父控件
x xy_t x坐标
y xy_t y坐标
w wh_t 宽度
h wh_t 高度

check_button_set_value 函数


  • 函数功能:

设置控件的值。

  • 函数原型:
  1. ret_t check_button_set_value (widget_t* widget, bool_t value);
  • 参数说明:
参数 类型 说明
返回值 ret_t 返回RET_OK表示成功,否则表示失败。
widget widget_t* check_button对象。
value bool_t

value 属性


值。

  • 类型:bool_t
特性 是否支持
可直接读取
可直接修改
可持久化
可脚本化
可在IDE中设置
可在XML中设置
可通过widget_get_prop读取
可通过widget_set_prop修改