「App:Library:LVGL:docs:Overview:Objects」の版間の差分

提供: robot-jp wiki
ナビゲーションに移動検索に移動
59行目: 59行目:
  
  
 +
 +
[[ファイル:LVGL docs overview objects 03.png|代替文=LVGL docs overview objects 03|サムネイル|LVGL docs overview objects 03]]
  
 
:[[App:Library:LVGL:docs:Overview|戻る : Previous]]
 
:[[App:Library:LVGL:docs:Overview|戻る : Previous]]

2022年6月22日 (水) 23:03時点における版

https://docs.lvgl.io/8.2/overview/object.html

英文 自動翻訳

Objects

In LVGL the basic building blocks of a user interface are the objects, also called Widgets. For example a Button, Label, Image, List, Chart or Text area.

You can see all the Object types here.

All objects are referenced using an lv_obj_t pointer as a handle. This pointer can later be used to set or get the attributes of the object.

Attributes

Basic attributes

All object types share some basic attributes:

  • Position
  • Size
  • Parent
  • Styles
  • Event handlers
  • Etc

You can set/get these attributes with lv_obj_set_... and lv_obj_get_... functions. For example:

/*Set basic object attributes*/
lv_obj_set_size(btn1, 100, 50);	  /*Set a button's size*/
lv_obj_set_pos(btn1, 20,30);      /*Set a button's position*/ 

To see all the available functions visit the Base object's documentation.

Specific attributes

The object types have special attributes too. For example, a slider has

  • Minimum and maximum values
  • Current value

For these special attributes, every object type may have unique API functions. For example for a slider:

/*Set slider specific attributes*/
lv_slider_set_range(slider1, 0, 100);	   				/*Set the min. and max. values*/
lv_slider_set_value(slider1, 40, LV_ANIM_ON);		/*Set the current value (position)*/

The API of the widgets is described in their Documentation but you can also check the respective header files (e.g. widgets/lv_slider.h)

Working mechanisms

Parent-child structure

A parent object can be considered as the container of its children. Every object has exactly one parent object (except screens), but a parent can have any number of children. There is no limitation for the type of the parent but there are objects which are typically a parent (e.g. button) or a child (e.g. label).

Moving together

If the position of a parent changes, the children will move along with it. Therefore, all positions are relative to the parent.

LVGL docs overview objects 01
LVGL docs overview objects 01
LVGL docs overview objects 02
LVGL docs overview objects 02



LVGL docs overview objects 03
LVGL docs overview objects 03
戻る : Previous