「App:Library:LVGL:docs:Widgets:Base object」の版間の差分
92行目: | 92行目: | ||
The following align types exist: | The following align types exist: | ||
− | [[file:LVGL docs widgets obj 01.png|link=https://docs.lvgl.io/8.2/widgets/obj.html#alignment| | + | [[file:LVGL docs widgets obj 01.png|link=https://docs.lvgl.io/8.2/widgets/obj.html#alignment|400px]] |
|親のオブジェクトを。で整列させることができます<code>lv_obj_set_align(obj, LV_ALIGN_...)</code>。この後、すべてのxとyの設定は、設定された位置合わせモードに関連します。たとえば、これにより、オブジェクトは親の中心から10;20pxシフトします。 | |親のオブジェクトを。で整列させることができます<code>lv_obj_set_align(obj, LV_ALIGN_...)</code>。この後、すべてのxとyの設定は、設定された位置合わせモードに関連します。たとえば、これにより、オブジェクトは親の中心から10;20pxシフトします。 | ||
2022年6月28日 (火) 17:56時点における版
https://docs.lvgl.io/8.2/widgets/index.html
Base object (lv_obj)
Overview
英文 | 自動翻訳 |
---|---|
The 'Base Object' implements the basic properties of widgets on a screen, such as:
The functions and functionalities of the Base object can be used with other widgets too. For example
|
「ベースオブジェクト」は、次のようなウィジェットの基本的なプロパティを画面に実装します。
オブジェクト指向の考え方では、LVGL内の他のすべてのオブジェクトが継承される基本クラスです。 Baseオブジェクトの機能は、他のウィジェットでも使用できます。例えば Baseオブジェクトは、単純なウィジェットとして直接使用できます。これは、長方形にすぎません。HTML用語では、それを。と考えて |
Coordinates
英文 | 自動翻訳 |
---|---|
Only a small subset of coordinate settings is described here. To see all the features of LVGL (padding, coordinates in styles, layouts, etc) visit the Coordinates page. |
ここでは、座標設定のごく一部についてのみ説明します。LVGLのすべての機能(パディング、スタイルの座標、レイアウトなど)を確認するには、[座標]ページにアクセスしてください。 |
Size
英文 | 自動翻訳 |
---|---|
The object size can be modified on individual axes with |
オブジェクトサイズは、とを使用して個々の軸で変更できますlv_obj_set_width(obj, new_width) 。lv_obj_set_height(obj, new_height) または、両方の軸を同時に変更することもできますlv_obj_set_size(obj, new_width, new_height) 。
|
Position
英文 | 自動翻訳 |
---|---|
You can set the position relative to the parent with |
lv_obj_set_x(obj, new_x) とを使用して親を基準にした位置を設定するlv_obj_set_y(obj, new_y) か、を使用して両方の軸を同時に設定できlv_obj_set_pos(obj, new_x, new_y) ます。
|
Alignment
英文 | 自動翻訳 |
---|---|
You can align the object on its parent with
lv_obj_set_align(obj, LV_ALIGN_CENTER);
lv_obj_set_pos(obj, 10, 20);
//Or in one function
lv_obj_align(obj, LV_ALIGN_CENTER, 10, 20);
To align one object to another use:
|
親のオブジェクトを。で整列させることができますlv_obj_set_align(obj, LV_ALIGN_...) 。この後、すべてのxとyの設定は、設定された位置合わせモードに関連します。たとえば、これにより、オブジェクトは親の中心から10;20pxシフトします。
lv_obj_set_align (obj 、 LV_ALIGN_CENTER ); lv_obj_set_pos (obj 、 10、20 ); _ //または1つの関数 でlv_obj_align (obj 、 LV_ALIGN_CENTER 、 10、20 ) ; あるオブジェクトを別のオブジェクトに揃えるには、次のようにします。 たとえば、画像の下にテキストを配置するには、次のようにします 次の整列タイプが存在します。 (絵) |
Parents and children
英文 | 自動翻訳 |
---|---|
You can set a new parent for an object with
uint32_t i;
for(i = 0i < lv_obj_get_child_cnt(parent)i++) {
lv_obj_t * child = lv_obj_get_child(parent, i);
/*Do something with child*/
}
You can change the index of an object in its parent using
|
を使用して、オブジェクトの新しい親を設定できますlv_obj_set_parent(obj, new_parent) 。現在の親を取得するには、を使用しますlv_obj_get_parent(obj) 。
親の特定の子を取得するには、を使用します
子供たちはこれを繰り返すことができます: uint32_t i ; for (i = 0 i < lv_obj_get_child_cnt (parent )i ++ ) { lv_obj_t * child = lv_obj_get_child (parent 、 i ); /*子供と何かをする*/ }
オブジェクトをフォアグラウンドに移動するか、およびを使用してバックグラウンドに送信でき を使用して、親のオブジェクトのインデックスを変更できます 2つのオブジェクトの位置を。と入れ替えることができます |
Display and Screens
英文 | 自動翻訳 |
---|---|
At the highest level of the LVGL object hierarchy is the display which represents the driver for a display device (physical display or simulator). A display can have one or more screens associated with it. Each screen contains a hierarchy of objects for graphical widgets representing a layout that covers the entire display.
If you have multiple displays, it's important to know that the screen functions operate on the most recently created display or the one explicitly selected with
|
LVGLオブジェクト階層の最上位レベルには、ディスプレイデバイス(物理ディスプレイまたはシミュレーター)のドライバーを表すディスプレイがあります。ディスプレイには、1つ以上の画面を関連付けることができます。各画面には、ディスプレイ全体をカバーするレイアウトを表すグラフィカルウィジェットのオブジェクトの階層が含まれています。
のような画面を作成したら 複数のディスプレイがある場合は、画面機能が最後に作成されたディスプレイまたはで明示的に選択されたディスプレイで動作することを知っておくことが重要 オブジェクトの画面を取得するには、 |
Events
英文 | 自動翻訳 |
---|---|
To set an event callback for an object, use
Read the Event overview to learn more about events. |
オブジェクトのイベントコールバックを設定するには、、を使用しlv_obj_add_event_cb(obj, event_cb, LV_EVENT_..., user_data) ます
イベントをオブジェクトに手動で送信するには、 イベントの詳細については、イベントの概要をお読みください。 |
Styles
英文 | 自動翻訳 |
---|---|
Be sure to read the Style overview. Here only the most essential functions are described.
The base objects use |
スタイルの概要を必ずお読みください。ここでは、最も重要な機能についてのみ説明します。
関数を使用して、オブジェクトに新しいスタイルを追加できます 基本オブジェクトは、 |
Flags
英文 | 自動翻訳 |
---|---|
/*Hide on object*/
lv_obj_add_flag(obj, LV_OBJ_FLAG_HIDDEN);
/*Make an object non-clickable*/
lv_obj_clear_flag(obj, LV_OBJ_FLAG_CLICKABLE);
/*Hide on object*/
lv_obj_add_flag(obj, LV_OBJ_FLAG_HIDDEN);
/*Make an object non-clickable*/
lv_obj_clear_flag(obj, LV_OBJ_FLAG_CLICKABLE);
|
Groups
英文 | 自動翻訳 |
---|---|
Read the Input devices overview to learn more about Groups.
|
Extended click area
英文 | 自動翻訳 |
---|---|
By default, the objects can be clicked only within their bounding area. However, this can be extended with |
Events
英文 | 自動翻訳 |
---|---|
Learn more about Events. |
Keys
英文 | 自動翻訳 |
---|---|
If If Learn more about Keys. |
Example
Base objects with custom styles
Make an object draggable
英文 | 自動翻訳 |
---|---|
API
英文 | 自動翻訳 |
---|---|
Typedefs typedef uint16_t lv_state_t typedef uint32_t lv_part_t typedef uint32_t lv_obj_flag_t typedef struct _lv_obj_t lv_obj_t Enums enum [anonymous]
enum [anonymous]
enum [anonymous]
enum lv_obj_draw_part_type_t
Functions void lv_init(void)
void lv_deinit(void)
bool lv_is_initialized(void)
lv_obj_t *lv_obj_create(lv_obj_t *parent)
void lv_obj_add_flag(lv_obj_t *obj, lv_obj_flag_t f)
void lv_obj_clear_flag(lv_obj_t *obj, lv_obj_flag_t f)
void lv_obj_add_state(lv_obj_t *obj, lv_state_t state)
void lv_obj_clear_state(lv_obj_t *obj, lv_state_t state)
static inline void lv_obj_set_user_data(lv_obj_t *obj, void *user_data)
bool lv_obj_has_flag(const lv_obj_t *obj, lv_obj_flag_t f)
bool lv_obj_has_flag_any(const lv_obj_t *obj, lv_obj_flag_t f)
lv_state_t lv_obj_get_state(const lv_obj_t *obj)
bool lv_obj_has_state(const lv_obj_t *obj, lv_state_t state)
void *lv_obj_get_group(const lv_obj_t *obj)
static inline void *lv_obj_get_user_data(lv_obj_t *obj)
void lv_obj_allocate_spec_attr(lv_obj_t *obj)
bool lv_obj_check_type(const lv_obj_t *obj, const lv_obj_class_t *class_p)
bool lv_obj_has_class(const lv_obj_t *obj, const lv_obj_class_t *class_p)
const lv_obj_class_t *lv_obj_get_class(const lv_obj_t *obj)
bool lv_obj_is_valid(const lv_obj_t *obj)
static inline lv_coord_t lv_obj_dpx(const lv_obj_t *obj, lv_coord_t n)
Variables const lv_obj_class_t lv_obj_class
struct _lv_obj_spec_attr_t
|