「App:Library:LVGL:docs:Overview:Input devices」の版間の差分
24行目: | 24行目: | ||
<span style="background-color:#DBFAF3;">重要事項<BR />この先を読む前に、入力デバイスの[移植]([[App:Library:LVGL:docs:Porting:Input device interface|'''/porting/indev''']])セクションを読んでください。</span> | <span style="background-color:#DBFAF3;">重要事項<BR />この先を読む前に、入力デバイスの[移植]([[App:Library:LVGL:docs:Porting:Input device interface|'''/porting/indev''']])セクションを読んでください。</span> | ||
|} | |} | ||
− | :[[App:Library:LVGL:docs:Overview|戻る : Previous]] | + | :[[App:Library:LVGL:docs:Overview"Input_devices|戻る : Previous]] |
61行目: | 61行目: | ||
画像の場合、クリックはデフォルトで無効になっています。 | 画像の場合、クリックはデフォルトで無効になっています。 | ||
|} | |} | ||
− | :[[App:Library:LVGL:docs:Overview|戻る : Previous]] | + | :[[App:Library:LVGL:docs:Overview"Input_devices|戻る : Previous]] |
138行目: | 138行目: | ||
オブジェクトがスクロールされている場合、ジェスチャーはトリガーされないことに注意してください。 | オブジェクトがスクロールされている場合、ジェスチャーはトリガーされないことに注意してください。 | ||
|} | |} | ||
− | :[[App:Library:LVGL:docs:Overview|戻る : Previous]] | + | :[[App:Library:LVGL:docs:Overview"Input_devices|戻る : Previous]] |
150行目: | 150行目: | ||
|タッチパッドやマウスがなくても、キーパッドやエンコーダー(複数可)を使ってユーザーインターフェースを完全に制御することができます。PCのTABキーでアプリケーションやウェブページの要素を選択するのと同じような動作です。 | |タッチパッドやマウスがなくても、キーパッドやエンコーダー(複数可)を使ってユーザーインターフェースを完全に制御することができます。PCのTABキーでアプリケーションやウェブページの要素を選択するのと同じような動作です。 | ||
|} | |} | ||
− | :[[App:Library:LVGL:docs:Overview|戻る : Previous]] | + | :[[App:Library:LVGL:docs:Overview"Input_devices|戻る : Previous]] |
189行目: | 189行目: | ||
グループと入力デバイスを関連付けるには、 <code style="color: #bb0000;">lv_indev_set_group(indev, g)</code>, を使用します。ここで、 <code style="color: #bb0000;">indev</code> は <code style="color: #bb0000;">lv_indev_drv_register()</code>の戻り値です。 | グループと入力デバイスを関連付けるには、 <code style="color: #bb0000;">lv_indev_set_group(indev, g)</code>, を使用します。ここで、 <code style="color: #bb0000;">indev</code> は <code style="color: #bb0000;">lv_indev_drv_register()</code>の戻り値です。 | ||
|} | |} | ||
− | :[[App:Library:LVGL:docs:Overview|戻る : Previous]] | + | :[[App:Library:LVGL:docs:Overview"Input_devices|戻る : Previous]] |
249行目: | 249行目: | ||
エンコーダでは、 <code style="color: #bb0000;">LV_KEY_LEFT</code>, <code style="color: #bb0000;">LV_KEY_RIGHT</code>, <code style="color: #bb0000;">LV_KEY_ENTER</code>のみを使用する必要があります。 | エンコーダでは、 <code style="color: #bb0000;">LV_KEY_LEFT</code>, <code style="color: #bb0000;">LV_KEY_RIGHT</code>, <code style="color: #bb0000;">LV_KEY_ENTER</code>のみを使用する必要があります。 | ||
|} | |} | ||
− | :[[App:Library:LVGL:docs:Overview|戻る : Previous]] | + | :[[App:Library:LVGL:docs:Overview"Input_devices|戻る : Previous]] |
300行目: | 300行目: | ||
しかし、ショートクリックが意味を持つオブジェクト(例:ボタン)の場合は、長押しが必要です。 | しかし、ショートクリックが意味を持つオブジェクト(例:ボタン)の場合は、長押しが必要です。 | ||
|} | |} | ||
− | :[[App:Library:LVGL:docs:Overview|戻る : Previous]] | + | :[[App:Library:LVGL:docs:Overview"Input_devices|戻る : Previous]] |
323行目: | 323行目: | ||
<code style="color: #bb0000;">lv_indev_set_group(my_indev, g);</code>で、デフォルトグループに1つ以上の入力デバイスを割り当てることを忘れないでください。 | <code style="color: #bb0000;">lv_indev_set_group(my_indev, g);</code>で、デフォルトグループに1つ以上の入力デバイスを割り当てることを忘れないでください。 | ||
|} | |} | ||
− | :[[App:Library:LVGL:docs:Overview|戻る : Previous]] | + | :[[App:Library:LVGL:docs:Overview"Input_devices|戻る : Previous]] |
346行目: | 346行目: | ||
より詳細な説明については、スタイルセクションを参照してください。 | より詳細な説明については、スタイルセクションを参照してください。 | ||
|} | |} | ||
− | :[[App:Library:LVGL:docs:Overview|戻る : Previous]] | + | :[[App:Library:LVGL:docs:Overview"Input_devices|戻る : Previous]] |
589行目: | 589行目: | ||
:: 見つかったオブジェクトへのポインタ。適切なオブジェクトがなかった場合はNULL | :: 見つかったオブジェクトへのポインタ。適切なオブジェクトがなかった場合はNULL | ||
|} | |} | ||
− | :[[App:Library:LVGL:docs:Overview|戻る : Previous]] | + | :[[App:Library:LVGL:docs:Overview"Input_devices|戻る : Previous]] |
1,018行目: | 1,018行目: | ||
− | + | [[App:Library:LVGL#Overview|戻る : Previous]] |
2022年7月2日 (土) 10:16時点における版
https://docs.lvgl.io/8.2/overview/indev.html
Input devices
英文 | 自動翻訳 |
---|---|
An input device usually means:
Important |
入力デバイスとは、通常、以下のようなものを指す。
重要事項 |
Pointers
Cursor
英文 | 自動翻訳 |
---|---|
Pointer input devices (like a mouse) can have a cursor. ...
lv_indev_t * mouse_indev = lv_indev_drv_register(&indev_drv);
LV_IMG_DECLARE(mouse_cursor_icon); /*Declare the image source.*/
lv_obj_t * cursor_obj = lv_img_create(lv_scr_act()); /*Create an image object for the cursor */
lv_img_set_src(cursor_obj, &mouse_cursor_icon); /*Set the image source*/
lv_indev_set_cursor(mouse_indev, cursor_obj); /*Connect the image object to the driver*/
Note that the cursor object should have For images, clicking is disabled by default. |
ポインタ入力デバイス(マウスなど)は、カーソルを持つことができます。
...
lv_indev_t * mouse_indev = lv_indev_drv_register(&indev_drv);
LV_IMG_DECLARE(mouse_cursor_icon); /*Declare the image source.*/
lv_obj_t * cursor_obj = lv_img_create(lv_scr_act()); /*Create an image object for the cursor */
lv_img_set_src(cursor_obj, &mouse_cursor_icon); /*Set the image source*/
lv_indev_set_cursor(mouse_indev, cursor_obj); /*Connect the image object to the driver*/
カーソルオブジェクトは 画像の場合、クリックはデフォルトで無効になっています。 |
Gestures
英文 | 自動翻訳 |
---|---|
Pointer input devices can detect basic gestures. By default, most of the widgets send the gestures to its parent, so finally the gestures can be detected on the screen object in a form of an For example: void my_event(lv_event_t * e)
{
lv_obj_t * screen = lv_event_get_current_target(e);
lv_dir_t dir = lv_indev_get_gesture_dir(lv_indev_act());
switch(dir) {
case LV_DIR_LEFT:
...
break;
case LV_DIR_RIGHT:
...
break;
case LV_DIR_TOP:
...
break;
case LV_DIR_BOTTOM:
...
break;
}
}
...
lv_obj_add_event_cb(screen1, my_event, LV_EVENT_GESTURE, NULL);
To prevent passing the gesture event to the parent from an object use Note that, gestures are not triggered if an object is being scrolled. |
ポインタ入力デバイスは、基本的なジェスチャーを検出することができます。
デフォルトでは、ほとんどのWidgetは、ジェスチャーをその親に送りますので、最終的にジェスチャーは、 例えば void my_event(lv_event_t * e)
{
lv_obj_t * screen = lv_event_get_current_target(e);
lv_dir_t dir = lv_indev_get_gesture_dir(lv_indev_act());
switch(dir) {
case LV_DIR_LEFT:
...
break;
case LV_DIR_RIGHT:
...
break;
case LV_DIR_TOP:
...
break;
case LV_DIR_BOTTOM:
...
break;
}
}
...
lv_obj_add_event_cb(screen1, my_event, LV_EVENT_GESTURE, NULL);
オブジェクトから親にジェスチャーイベントを渡さないようにするには、 を使用してください。 オブジェクトがスクロールされている場合、ジェスチャーはトリガーされないことに注意してください。 |
Keypad and encoder
英文 | 自動翻訳 |
---|---|
You can fully control the user interface without a touchpad or mouse by using a keypad or encoder(s). It works similar to the TAB key on the PC to select an element in an application or a web page. |
タッチパッドやマウスがなくても、キーパッドやエンコーダー(複数可)を使ってユーザーインターフェースを完全に制御することができます。PCのTABキーでアプリケーションやウェブページの要素を選択するのと同じような動作です。 |
Groups
英文 | 自動翻訳 |
---|---|
Objects you want to control with a keypad or encoder need to be added to a Group. In every group there is exactly one focused object which receives the pressed keys or the encoder actions. For example, if a Text area is focused and you press some letter on a keyboard, the keys will be sent and inserted into the text area. Similarly, if a Slider is focused and you press the left or right arrows, the slider's value will be changed.
An input device can send key events to only one group but a group can receive data from more than one input device. To create a group use To associate a group with an input device use |
キーパッドやエンコーダで操作したいオブジェクトは、グループに追加する必要があります。各グループには、押されたキーやエンコーダの操作を受け取る、フォーカスされたオブジェクトが1つだけあります。
たとえば、テキストエリアにフォーカスがあり、キーボードで文字を押すと、そのキーが送信され、テキストエリアに挿入されます。 同様に、スライダーがフォーカスされていて、左または右の矢印を押すと、スライダーの値が変更されます。
入力デバイスはキーイベントを1つのグループにしか送れませんが、グループは複数の入力デバイスからデータを受信することができます。 グループを作るには、
|
Keys
英文 | 自動翻訳 |
---|---|
There are some predefined keys which have special meaning:
Usually, it's enough to use only With an encoder you should use only |
特別な意味を持つ定義済みのキーがいくつかある。
|
英文 | 自動翻訳 |
---|---|
Since a keypad has plenty of keys, it's easy to navigate between objects and edit them using the keypad. But encoders have a limited number of "keys" and hence it is difficult to navigate using the default options. Navigate and Edit modes are used to avoid this problem with encoders.
Therefore, the next or previous object will be selected by turning the encoder. Pressing
Depending on the object's type, a short or long press of Usually, an object which cannot be pressed (like a Slider) leaves Edit mode upon a short click. But with objects where a short click has meaning (e.g. Button), a long press is required. |
キーパッドにはたくさんのキーがあるので、キーパッドを使用してオブジェクト間を移動し、編集することは簡単です。
しかし、エンコーダは「キー」の数が限られているため、デフォルトのオプションを使用してナビゲートすることは困難です。 ナビゲートモードと編集モードは、エンコーダのこの問題を回避するために使用されます。 ナビゲートモードでは、エンコーダの そのため、エンコーダを回すと、次のオブジェクトや前のオブジェクトが選択されます。
オブジェクトの種類によっては、 通常、スライダーのように押せないオブジェクトはショートクリックでEditモードになります。 しかし、ショートクリックが意味を持つオブジェクト(例:ボタン)の場合は、長押しが必要です。 |
Default group
英文 | 自動翻訳 |
---|---|
Interactive widgets - such as buttons, checkboxes, sliders, etc. - can be automatically added to a default group.
Don't forget to assign one or more input devices to the default group with |
ボタン、チェックボックス、スライダーなどのインタラクティブなウィジェットを、デフォルトのグループに自動的に追加できます。- は、デフォルト・グループに自動的に追加することができます。
|
Styling
英文 | 自動翻訳 |
---|---|
If an object is focused either by clicking it via touchpad or focused via an encoder or keypad it goes to the If an object switches to edit mode it enters the For a more detailed description read the Style section. |
オブジェクトがタッチパッドでクリックされるか、エンコーダやキーパッドでフォーカスされると、 LV_STATE_FOCUSED の状態になる。
したがって、フォーカスされたスタイルが適用されます。
より詳細な説明については、スタイルセクションを参照してください。 |
API
Input device
英文 | 自動翻訳 |
---|---|
Functions void lv_indev_read_timer_cb(lv_timer_t *timer)
void lv_indev_enable(lv_indev_t *indev, bool en) lv_indev_t *lv_indev_get_act(void)
lv_indev_type_t lv_indev_get_type(const lv_indev_t *indev)
void lv_indev_reset(lv_indev_t *indev, lv_obj_t *obj)
void lv_indev_reset_long_press(lv_indev_t *indev)
void lv_indev_set_cursor(lv_indev_t *indev, lv_obj_t *cur_obj)
void lv_indev_set_group(lv_indev_t *indev, lv_group_t *group)
void lv_indev_set_button_points(lv_indev_t *indev, const lv_point_t points[])
void lv_indev_get_point(const lv_indev_t *indev, lv_point_t *point)
lv_dir_t lv_indev_get_gesture_dir(const lv_indev_t *indev)
uint32_t lv_indev_get_key(const lv_indev_t *indev)
lv_dir_t lv_indev_get_scroll_dir(const lv_indev_t *indev)
lv_obj_t *lv_indev_get_scroll_obj(const lv_indev_t *indev)
void lv_indev_get_vect(const lv_indev_t *indev, lv_point_t *point)
void lv_indev_wait_release(lv_indev_t *indev)
lv_obj_t *lv_indev_get_obj_act(void)
lv_timer_t *lv_indev_get_read_timer(lv_disp_t *indev)
lv_obj_t *lv_indev_search_obj(lv_obj_t *obj, lv_point_t *point)
|
Functions
void lv_indev_read_timer_cb(lv_timer_t *timer)
void lv_indev_enable(lv_indev_t *indev, bool en) lv_indev_t *lv_indev_get_act(void)
lv_indev_type_t lv_indev_get_type(const lv_indev_t *indev)
void lv_indev_reset(lv_indev_t *indev, lv_obj_t *obj)
void lv_indev_reset_long_press(lv_indev_t *indev)
void lv_indev_set_cursor(lv_indev_t *indev, lv_obj_t *cur_obj)
void lv_indev_set_group(lv_indev_t *indev, lv_group_t *group)
void lv_indev_set_button_points(lv_indev_t *indev, const lv_point_t points[])
void lv_indev_get_point(const lv_indev_t *indev, lv_point_t *point)
lv_dir_t lv_indev_get_gesture_dir(const lv_indev_t *indev)
uint32_t lv_indev_get_key(const lv_indev_t *indev)
lv_dir_t lv_indev_get_scroll_dir(const lv_indev_t *indev)
lv_obj_t *lv_indev_get_scroll_obj(const lv_indev_t *indev)
void lv_indev_get_vect(const lv_indev_t *indev, lv_point_t *point)
void lv_indev_wait_release(lv_indev_t *indev)
lv_obj_t *lv_indev_get_obj_act(void)
lv_timer_t *lv_indev_get_read_timer(lv_disp_t *indev)
lv_obj_t *lv_indev_search_obj(lv_obj_t *obj, lv_point_t *point)
|
Groups
英文 | 自動翻訳 |
---|---|
Typedefs typedef uint8_t lv_key_t typedef void (*lv_group_focus_cb_t)(struct _lv_group_t*) typedef struct _lv_group_t lv_group_t
Enums enum [anonymous]
enum lv_group_refocus_policy_t
Functions void _lv_group_init(void)
lv_group_t *lv_group_create(void)
void lv_group_del(lv_group_t *group)
void lv_group_set_default(lv_group_t *group)
lv_group_t *lv_group_get_default(void)
void lv_group_add_obj(lv_group_t *group, struct _lv_obj_t *obj)
void lv_group_swap_obj(struct _lv_obj_t *obj1, struct _lv_obj_t *obj2)
void lv_group_remove_obj(struct _lv_obj_t *obj)
void lv_group_remove_all_objs(lv_group_t *group)
void lv_group_focus_obj(struct _lv_obj_t *obj)
void lv_group_focus_next(lv_group_t *group)
void lv_group_focus_prev(lv_group_t *group)
void lv_group_focus_freeze(lv_group_t *group, bool en)
lv_res_t lv_group_send_data(lv_group_t *group, uint32_t c)
void lv_group_set_focus_cb(lv_group_t *group, lv_group_focus_cb_t focus_cb)
void lv_group_set_refocus_policy(lv_group_t *group, lv_group_refocus_policy_t policy)
void lv_group_set_editing(lv_group_t *group, bool edit)
void lv_group_set_wrap(lv_group_t *group, bool en)
struct _lv_obj_t *lv_group_get_focused(const lv_group_t *group)
lv_group_focus_cb_t lv_group_get_focus_cb(const lv_group_t *group)
bool lv_group_get_editing(const lv_group_t *group)
bool lv_group_get_wrap(lv_group_t *group)
uint32_t lv_group_get_obj_count(lv_group_t *group)
struct _lv_group_t
|
Typedefs
typedef uint8_t lv_key_t typedef void (*lv_group_focus_cb_t)(struct _lv_group_t*) typedef struct _lv_group_t lv_group_t
Enums enum [anonymous]
enum lv_group_refocus_policy_t
Functions void _lv_group_init(void)
lv_group_t *lv_group_create(void)
void lv_group_del(lv_group_t *group)
void lv_group_set_default(lv_group_t *group)
lv_group_t *lv_group_get_default(void)
void lv_group_add_obj(lv_group_t *group, struct _lv_obj_t *obj)
void lv_group_swap_obj(struct _lv_obj_t *obj1, struct _lv_obj_t *obj2)
void lv_group_remove_obj(struct _lv_obj_t *obj)
void lv_group_remove_all_objs(lv_group_t *group)
void lv_group_focus_obj(struct _lv_obj_t *obj)
void lv_group_focus_next(lv_group_t *group)
void lv_group_focus_prev(lv_group_t *group)
void lv_group_focus_freeze(lv_group_t *group, bool en)
lv_res_t lv_group_send_data(lv_group_t *group, uint32_t c)
void lv_group_set_focus_cb(lv_group_t *group, lv_group_focus_cb_t focus_cb)
void lv_group_set_refocus_policy(lv_group_t *group, lv_group_refocus_policy_t policy)
void lv_group_set_editing(lv_group_t *group, bool edit)
void lv_group_set_wrap(lv_group_t *group, bool en)
struct _lv_obj_t *lv_group_get_focused(const lv_group_t *group)
lv_group_focus_cb_t lv_group_get_focus_cb(const lv_group_t *group)
bool lv_group_get_editing(const lv_group_t *group)
bool lv_group_get_wrap(lv_group_t *group)
uint32_t lv_group_get_obj_count(lv_group_t *group)
struct _lv_group_t
|