App:Library:LVGL:docs:Widgets:Base object
https://docs.lvgl.io/latest/en/html/widgets/obj.html
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:
In object-oriented thinking, it is the base class from which all other objects in LVGL are inherited. This, among another things, helps reduce code duplication. The functions and functionalities of Base object can be used with other widgets too. For example
|
ベースオブジェクト」は、画面上のウィジェットの基本的なプロパティを実装したもので、次のようなものです。
オブジェクト指向の考え方では、LVGL の他のすべてのオブジェクトが継承される基本クラスです。 これはコードの重複を減らすのに役立ちます。
|
Coordinates
Size
英文 | 自動翻訳 |
---|---|
The object size can be modified on individual axes with
In a more exact way:
|
オブジェクトのサイズは、lv_obj_set_width(obj, new_width) およびlv_obj_set_height(obj, new_height) を使用して個々の軸上で変更することも、lv_obj_set_size(obj, new_width, new_height) を使用して両方の軸を同時に変更することもできます。
より正確な方法: new_width = left_pad + object_width + right_pad パディングによって削減された幅または高さを取得するには、lv_obj_get_width/height_fit(obj) を使用します。 これは「オブジェクトの有用なサイズ」と見なすことができます。
|
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 to another with lv_obj_align(obj, obj_ref, LV_ALIGN_..., x_ofs, y_ofs) .
|
lv_obj_align(obj, obj_ref, LV_ALIGN_..., x_ofs, y_ofs) を使用して、オブジェクトを別のオブジェクトに位置合わせできます。
|
|
|
For example, to align a text below an image: lv_obj_align(text, image, LV_ALIGN_OUT_BOTTOM_MID, 0, 10) .
Or to align a text in the middle of its parent:
You can then realign the objects simply by calling It's equivalent to calling |
たとえば、画像の下にテキストを配置するには: lv_obj_align(text, image, LV_ALIGN_OUT_BOTTOM_MID, 0, 10)。
または、テキストをその親の中央に配置するには: lv_obj_align(text, NULL, LV_ALIGN_CENTER, 0, 0)。
その後、lv_obj_realign(obj) を呼び出すだけでオブジェクトを再配置できます。 同じパラメーターで lv_obj_align を再度呼び出すことと同じです。 |
If the alignment happened with lv_obj_align_origo , then it will be used when the object is realigned.
|
アライメントが lv_obj_align_origo で発生した場合、オブジェクトが再アライメントされるときに使用されます。
|
Parents and children
英文 | 自動翻訳 |
---|---|
You can set a new parent for an object with lv_obj_set_parent(obj, new_parent) .
To get the current parent, use To get the children of an object, use |
lv_obj_set_parent(obj, new_parent) を使用して、オブジェクトの新しい親を設定できます。
現在の親を取得するには、lv_obj_get_parent(obj) を使用します。
|
lv_obj_t * child = lv_obj_get_child(parent, NULL);
while(child) {
/*Do something with "child" */
child = lv_obj_get_child(parent, child);
}
| |
lv_obj_get_index(obj) tells the number of children on an object.
It is equivalent to the number of younger children in the parent.
|
lv_obj_get_index(obj) は、オブジェクトの子の数を示します。
これは、親の年少の子供の数に相当します。
|
Screens
英文 | 自動翻訳 |
---|---|
When you have created a screen like
|
lv_obj_t * screen = lv_obj_create(NULL, NULL) のように画面を作成したら、lv_scr_load(screen) で読み込むことができます。 lv_scr_act() 関数は、現在の画面へのポインターを提供します。
|
Layers
英文 | 自動翻訳 |
---|---|
There are two automatically generated layers:
The top layer is above every object on the screen and the system layer is above the top layer too. You can add any pop-up windows to the top layer freely. But, the system layer is restricted to system-level things (e.g. mouse cursor will be placed here in
|
2 つの自動生成レイヤーがあります。
最上層に任意のポップアップ ウィンドウを自由に追加できます。 ただし、システム レイヤーはシステム レベルのものに制限されます (たとえば、マウス カーソルは lv_indev_set_cursor() でここに配置されます)。
|
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) を使い、
イベントを手動でオブジェクトに送信するには、 イベントの詳細については、 「イベントの概要」 を参照してください。 |
Parts
英文 | 自動翻訳 |
---|---|
To set an event callback for an object, use lv_obj_set_event_cb(obj, event_cb) ,
|
オブジェクトのイベント コールバックを設定するには、lv_obj_set_event_cb(obj, event_cb) を使用します。
|
States
英文 | 自動翻訳 |
---|---|
The widgets can have multiple parts. For example a Button has only a main part but a Slider is built from a background, an indicator and a knob.
|
ウィジェットには複数のパーツを含めることができます。 たとえば、ボタンには主要な部分しかありませんが、スライダーは背景、インジケーター、およびノブから構築されます。
|
Styles
英文 | 自動翻訳 |
---|---|
Be sure to read the Style overview first.
The Base object use all the rectangle-like style properties.
If the parameter of |
最初に必ずスタイルの概要をお読みください。
Base オブジェクトは、すべての長方形のようなスタイル プロパティを使用します。
|
Attributes
英文 | 自動翻訳 |
---|---|
There are some attributes which can be enabled/disabled by lv_obj_set_...(obj, true/false) :
|
lv_obj_set_...(obj, true/false) で有効/無効にできる属性がいくつかあります:
|
Protect
英文 | 自動翻訳 |
---|---|
There are some specific actions which happen automatically in the library.
To prevent one or more that kind of actions, you can protect the object against them. The following protections exists:
|
ライブラリで自動的に発生する特定のアクションがいくつかあります。
そのようなアクションを 1 つ以上防止するために、オブジェクトをそれらから保護することができます。 次の保護が存在します。
|
Groups
英文 | 自動翻訳 |
---|---|
Once, an object is added to group with
|
オブジェクトが lv_group_add_obj(group, obj) でグループに追加されると、オブジェクトの現在のグループは lv_obj_get_group(obj) で取得できます。
|
Extended click area
英文 | 自動翻訳 |
---|---|
By default, the objects can be clicked only on their coordinates, however, this area can be extended with
|
デフォルトでは、オブジェクトは座標上でのみクリックできますが、この領域は lv_obj_set_ext_click_area(obj, left, right, top, bottom) で拡張できます。 left/right/top/bottom は、クリック可能な領域がデフォルトを超えて各方向にどれだけ拡張されるかを示します。
|
Events
英文 | 自動翻訳 |
---|---|
Only the Generic events are sent by the object type.
|
オブジェクト タイプによって送信されるのは Generic events のみです。
詳細はEventsをご覧ください。 |
Keys
英文 | 自動翻訳 |
---|---|
No Keys are processed by the object type.
|
オブジェクト タイプによって処理されるキーはありません。
|