「App:Library:LVGL:docs:Overview:Events」の版間の差分
(同じ利用者による、間の11版が非表示) | |||
11行目: | 11行目: | ||
* is clicked | * is clicked | ||
* is scrolled | * is scrolled | ||
− | * | + | * its value changed |
− | |||
|LVGLでは、ユーザが興味を持ちそうなことが起こったときに、イベントが発生します。 | |LVGLでは、ユーザが興味を持ちそうなことが起こったときに、イベントが発生します。 | ||
18行目: | 17行目: | ||
* スクロールされたとき | * スクロールされたとき | ||
* その値が変更されたとき | * その値が変更されたとき | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | |The user can assign a callback function to an object to see these events. |
− | The user can assign callback | ||
− | |||
In practice, it looks like this: | In practice, it looks like this: | ||
− | <syntaxhighlight lang="C++" style="border:1px dashed gray;"> | + | |ユーザーは、コールバック関数をオブジェクトに割り当てて、これらのイベントを確認できます。 |
− | + | 実際には、次のようになります。 | |
− | + | |- | |
− | + | | colspan="2" | | |
− | + | <syntaxhighlight lang="C++" style="border: 1px dashed gray;"> | |
− | + | lv_obj_t * btn = lv_btn_create(lv_scr_act(), NULL); | |
− | + | lv_obj_set_event_cb(btn, my_event_cb); /*Assign an event callback*/ | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | ... | |
+ | static void my_event_cb(lv_obj_t * obj, lv_event_t event) | ||
+ | { | ||
+ | switch(event) { | ||
+ | case LV_EVENT_PRESSED: | ||
+ | printf("Pressed\n"); | ||
+ | break; | ||
− | + | case LV_EVENT_SHORT_CLICKED: | |
+ | printf("Short clicked\n"); | ||
+ | break; | ||
− | + | case LV_EVENT_CLICKED: | |
+ | printf("Clicked\n"); | ||
+ | break; | ||
− | + | case LV_EVENT_LONG_PRESSED: | |
− | + | printf("Long press\n"); | |
− | + | break; | |
− | |||
− | |||
− | |||
− | |||
− | + | case LV_EVENT_LONG_PRESSED_REPEAT: | |
− | + | printf("Long press repeat\n"); | |
− | + | break; | |
− | |||
− | |||
− | |||
− | + | case LV_EVENT_RELEASED: | |
− | + | printf("Released\n"); | |
+ | break; | ||
+ | } | ||
− | + | /*Etc.*/ | |
− | + | } | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | |- | |
− | + | |More objects can use the same ''event callback''. | |
− | + | |より多くのオブジェクトが同じイベント コールバックを使用できます。 | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|} | |} | ||
:[[App:Library:LVGL:docs:Overview#Events|戻る : Previous]] | :[[App:Library:LVGL:docs:Overview#Events|戻る : Previous]] | ||
− | == | + | ==== Event types ==== |
{| class="wikitable" | {| class="wikitable" | ||
− | + | |The following event types exist: | |
− | + | |次のイベント タイプが存在します。 | |
− | | | + | |} |
− | | | ||
− | |||
− | + | ===== Generic events ===== | |
− | | | + | {| class="wikitable" |
− | + | |All objects (such as Buttons/Labels/Sliders etc.) receive these generic events regardless of their type. | |
+ | |すべてのオブジェクト (ボタン/ラベル/スライダーなど) は、タイプに関係なく、これらの一般的なイベントを受け取ります。 | ||
|} | |} | ||
− | |||
+ | ====== Related to the input devices ====== | ||
+ | {| class="wikitable" | ||
+ | |These are sent when an object is pressed/released etc. by the user. They are used not only for ''Pointers'' but can used for ''Keypad'', ''Encoder'' and ''Button'' input devices as well. Visit the [[App:Library:LVGL:docs:Overview:Input devices|<u>'''Overview of input devices'''</u>]] section to learn more about them. | ||
− | == | + | * '''LV_EVENT_PRESSED''' The object has been pressed |
− | + | * '''LV_EVENT_PRESSING''' The object is being pressed (sent continuously while pressing) | |
− | + | * '''LV_EVENT_PRESS_LOST''' The input device is still being pressed but is no longer on the object | |
− | + | * '''LV_EVENT_SHORT_CLICKED''' Released before <code style="color: #bb0000;">LV_INDEV_LONG_PRESS_TIME</code> time. Not called if dragged. | |
− | + | * '''LV_EVENT_LONG_PRESSED''' Pressing for <code style="color: #bb0000;">LV_INDEV_LONG_PRESS_TIME</code> time. Not called if dragged. | |
− | | | + | * '''LV_EVENT_LONG_PRESSED_REPEAT''' Called after <code style="color: #bb0000;">LV_INDEV_LONG_PRESS_TIME</code> in every <code style="color: #bb0000;">LV_INDEV_LONG_PRESS_REP_TIME</code> ms. Not called if dragged. |
− | + | * '''LV_EVENT_CLICKED''' Called on release if not dragged (regardless to long press) | |
+ | * '''LV_EVENT_RELEASED''' Called in every case when the object has been released even if it was dragged. Not called if slid from the object while pressing and released outside of the object. In this case, <code style="color: #bb0000;">LV_EVENT_PRESS_LOST</code> is sent. | ||
+ | |これらは、ユーザーがオブジェクトを押したり離したりしたときに送信されます。ポインターだけでなく、キーパッド、エンコーダー、ボタン入力デバイスにも使用できます。詳細については、入力デバイスの概要セクションをご覧ください。 | ||
− | * | + | * '''LV_EVENT_PRESSED''' オブジェクトが押されました |
− | * | + | * '''LV_EVENT_PRESSING''' オブジェクトが押されている (押されている間、連続して送信される) |
− | * | + | * '''LV_EVENT_PRESS_LOST''' 入力デバイスはまだ押されていますが、オブジェクト上にはありません |
− | * | + | * '''LV_EVENT_SHORT_CLICKED''' <code style="color: #bb0000;">LV_INDEV_LONG_PRESS_TIME</code> 時間前に解放されました。ドラッグしても呼び出されません。 |
− | * | + | * '''LV_EVENT_LONG_PRESSED''' <code style="color: #bb0000;">LV_INDEV_LONG_PRESS_TIME</code> 時間押す。ドラッグしても呼び出されません。 |
+ | * '''LV_EVENT_LONG_PRESSED_REPEAT''' <code style="color: #bb0000;">LV_INDEV_LONG_PRESS_REP_TIME</code> ミリ秒ごとに <code style="color: #bb0000;">LV_INDEV_LONG_PRESS_TIME</code> の後に呼び出されます。ドラッグしても呼び出されません。 | ||
+ | * '''LV_EVENT_CLICKED''' ドラッグされていない場合、リリース時に呼び出されます (長押しに関係なく) | ||
+ | * '''LV_EVENT_RELEASED''' ドラッグされた場合でも、オブジェクトが解放された場合に毎回呼び出されます。押しながらオブジェクトからスライドし、オブジェクトの外で離した場合は呼び出されません。この場合、<code style="color: #bb0000;">LV_EVENT_PRESS_LOST</code> が送信されます。 | ||
+ | |} | ||
− | + | ====== Related to pointer ====== | |
+ | {| class="wikitable" | ||
+ | |These events are sent only by pointer-like input devices (E.g. mouse or touchpad) | ||
− | + | * '''LV_EVENT_DRAG_BEGIN''' Dragging of the object has started | |
+ | * '''LV_EVENT_DRAG_END''' Dragging finished (including drag throw) | ||
+ | * '''LV_EVENT_DRAG_THROW_BEGIN''' Drag throw started (released after drag with "momentum") | ||
+ | |これらのイベントは、ポインターのような入力デバイス (マウスやタッチパッドなど) によってのみ送信されます。 | ||
− | '' | + | * '''LV_EVENT_DRAG_BEGIN''' オブジェクトのドラッグを開始しました |
+ | * '''LV_EVENT_DRAG_END''' ドラッグ終了(ドラッグスロー含む) | ||
+ | * '''LV_EVENT_DRAG_THROW_BEGIN''' ドラッグ投げ開始(「勢い」でドラッグ後リリース) | ||
+ | |} | ||
− | + | ====== Related to keypad and encoder ====== | |
− | | | + | {| class="wikitable" |
+ | |These events are sent by keypad and encoder input devices. Learn more about ''Groups'' in [overview/indev](Input devices) section. | ||
− | * | + | * '''LV_EVENT_KEY''' A ''Key'' is sent to the object. Typically when it was pressed or repeated after a long press. The key can be retrived by <code style="color: #bb0000;">uint32_t * key = lv_event_get_data()</code> |
− | * | + | * '''LV_EVENT_FOCUSED''' The object is focused in its group |
− | * | + | * '''LV_EVENT_DEFOCUSED''' The object is defocused in its group |
− | * | + | |これらのイベントは、キーパッドとエンコーダの入力デバイスによって送信されます。 グループの詳細については、[概要/indev](入力デバイス) セクションを参照してください。 |
− | |||
− | + | * '''LV_EVENT_KEY''' オブジェクトにキーが送信されます。 通常、長押しの後に押された、または繰り返されたとき。 キーは <code style="color: #bb0000;">uint32_t * key = lv_event_get_data()</code> で取得できます | |
+ | * '''LV_EVENT_FOCUSED''' オブジェクトはそのグループにフォーカスされています | ||
+ | * '''LV_EVENT_DEFOCUSED''' オブジェクトはそのグループ内で焦点が合っていません | ||
+ | |} | ||
− | + | ====== General events ====== | |
+ | {| class="wikitable" | ||
+ | |Other general events sent by the library. | ||
− | + | * '''LV_EVENT_DELETE''' The object is being deleted. Free the related user-allocated data. | |
+ | |図書館から送られるその他の一般的なイベント。 | ||
− | + | * '''LV_EVENT_DELETE''' オブジェクトは削除中です。 関連するユーザー割り当てデータを解放します。 | |
|} | |} | ||
− | |||
− | |||
− | === | + | ===== Special events ===== |
{| class="wikitable" | {| class="wikitable" | ||
− | + | |These events are specific to a particular object type. | |
− | |||
− | | | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | * '''LV_EVENT_VALUE_CHANGED''' The object value has changed (e.g. for a [[App:Library:LVGL:docs:Widgets:Slider (lv slider)|<u>'''Slider'''</u>]]) | ||
+ | * '''LV_EVENT_INSERT''' Something is inserted to the object. (Typically to a [[App:Library:LVGL:docs:Widgets:Text area (lv textarea)|<u>'''Text area'''</u>]]) | ||
+ | * '''LV_EVENT_APPLY''' "Ok", "Apply" or similar specific button has clicked. (Typically from a [[App:Library:LVGL:docs:Widgets:Keyboard (lv keyboard)|<u>'''Keyboard'''</u>]] object) | ||
+ | * '''LV_EVENT_CANCEL''' "Close", "Cancel" or similar specific button has clicked. (Typically from a Keyboard object) | ||
+ | * '''LV_EVENT_REFRESH''' Query to refresh the object. Never sent by the library but can be sent by the user. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | Visit particular [[App:Library:LVGL:docs:Widgets|'''<u>Object type's documentation</u>''']] to understand which events are used by an object type. | |
− | | | + | |これらのイベントは、特定のオブジェクト タイプに固有です。 |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | * '''LV_EVENT_VALUE_CHANGED''' オブジェクトの値が変更されました (例: [[App:Library:LVGL:docs:Widgets:Slider (lv slider)|<u>'''Slider'''</u>]] の場合) | |
− | + | * '''LV_EVENT_INSERT''' オブジェクトに何かが挿入されました。 (通常は[[App:Library:LVGL:docs:Widgets:Text area (lv textarea)|<u>'''Text area'''</u>]]に) | |
− | + | * '''LV_EVENT_APPLY''' 「OK」、「適用」などの特定のボタンがクリックされた。 (通常は [[App:Library:LVGL:docs:Widgets:Keyboard (lv keyboard)|<u>'''Keyboard'''</u>]] オブジェクトから) | |
+ | * '''LV_EVENT_CANCEL''' 「閉じる」「キャンセル」などの特定のボタンがクリックされた。 (通常は Keyboard オブジェクトから) | ||
+ | * '''LV_EVENT_REFRESH''' オブジェクトをリフレッシュするクエリ。 ライブラリによって送信されることはありませんが、ユーザーによって送信される可能性があります。 | ||
− | + | オブジェクト タイプで使用されるイベントを理解するには、特定の[[App:Library:LVGL:docs:Widgets|'''<u>Object type's documentation</u>''']]を参照してください。 | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|} | |} | ||
− | |||
− | |||
− | === | + | === Custom data === |
{| class="wikitable" | {| class="wikitable" | ||
− | + | |Some events might contain custom data. For example, <code style="color: #bb0000;">LV_EVENT_VALUE_CHANGED</code> in some cases tells the new value. For more information, see the particular [[App:Library:LVGL:docs:Widgets|'''<u>Object type's documentation</u>''']]. To get the custom data in the event callback use <code style="color: #bb0000;">lv_event_get_data()</code>. | |
− | |||
− | | | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | | | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | The type of the custom data depends on the sending object but if it's a | ||
− | === | + | * single number then it's <code style="color: #bb0000;">uint32_t *</code> or <code style="color: #bb0000;">int32_t *</code> |
− | + | * text then <code style="color: #bb0000;">char *</code> or <code style="color: #bb0000;">const char *</code> | |
− | + | |一部のイベントには、カスタム データが含まれる場合があります。 たとえば、場合によっては <code style="color: #bb0000;">LV_EVENT_VALUE_CHANGED</code> が新しい値を示します。 詳細については、特定の[[App:Library:LVGL:docs:Widgets|'''<u>Object type's documentation</u>''']]を参照してください。 イベント コールバックでカスタム データを取得するには、<code style="color: #bb0000;">lv_event_get_data()</code> を使用します。 | |
− | |||
− | | | ||
− | |||
− | |||
− | + | カスタム データのタイプは送信オブジェクトによって異なりますが、 | |
− | |||
− | + | * 単一の数値の場合は <code style="color: #bb0000;">uint32_t *</code> または <code style="color: #bb0000;">int32_t *</code> | |
+ | * text の次に <code style="color: #bb0000;">char *</code> または <code style="color: #bb0000;">const char *</code> | ||
|} | |} | ||
:[[App:Library:LVGL:docs:Overview#Events|戻る : Previous]] | :[[App:Library:LVGL:docs:Overview#Events|戻る : Previous]] | ||
− | == | + | === Send events manually === |
+ | ==== Arbitrary events ==== | ||
{| class="wikitable" | {| class="wikitable" | ||
− | + | |To manually send events to an object, use <code style="color: #bb0000;">lv_event_send(obj, LV_EVENT_..., &custom_data)</code>. | |
− | |||
− | | | ||
− | |||
− | To manually send events to an object, use <code style="color: #bb0000;">lv_event_send(obj, | ||
− | For example, | + | For example, it can be used to manually close a message box by simulating a button press (although there are simpler ways of doing this): |
− | + | |イベントをオブジェクトに手動で送信するには、<code style="color: #bb0000;">lv_event_send(obj, LV_EVENT_..., &custom_data)</code> を使用します。 | |
− | |||
− | |||
− | |||
− | |||
− | | | ||
− | + | たとえば、ボタンの押下をシミュレートすることにより、メッセージ ボックスを手動で閉じるために使用できます (ただし、これを行うより簡単な方法があります)。 | |
− | <syntaxhighlight lang="C++" style="border:1px dashed gray;"> | + | |- |
− | + | | colspan="2" | | |
− | + | <syntaxhighlight lang="C++" style="border: 1px dashed gray;"> | |
− | + | /*Simulate the press of the first button (indexes start from zero)*/ | |
− | </syntaxhighlight> | + | uint32_t btn_id = 0; |
+ | lv_event_send(mbox, LV_EVENT_VALUE_CHANGED, &btn_id); | ||
+ | </syntaxhighlight> | ||
|} | |} | ||
:[[App:Library:LVGL:docs:Overview#Events|戻る : Previous]] | :[[App:Library:LVGL:docs:Overview#Events|戻る : Previous]] | ||
− | + | ==== Refresh event ==== | |
− | === Refresh event === | ||
{| class="wikitable" | {| class="wikitable" | ||
− | + | |<code style="color: #bb0000;">LV_EVENT_REFRESH</code> is special event because it's designed to be used by the user to notify an object to refresh itself. Some examples: | |
− | |||
− | | | ||
− | |||
− | <code style="color: #bb0000;">LV_EVENT_REFRESH</code> is | ||
* notify a label to refresh its text according to one or more variables (e.g. current time) | * notify a label to refresh its text according to one or more variables (e.g. current time) | ||
360行目: | 210行目: | ||
* enable a button if some conditions are met (e.g. the correct PIN is entered) | * enable a button if some conditions are met (e.g. the correct PIN is entered) | ||
* add/remove styles to/from an object if a limit is exceeded, etc | * add/remove styles to/from an object if a limit is exceeded, etc | ||
− | |||
− | + | To simplest way to handle similar cases is utilizing the following functions. | |
− | |||
− | |||
− | |||
− | |||
− | |||
+ | <code style="color: #bb0000;">lv_event_send_refresh(obj)</code> is just a wrapper to <code style="color: #bb0000;">lv_event_send(obj, LV_EVENT_REFRESH, NULL)</code>. | ||
− | + | So it simply sends an <code style="color: #bb0000;">LV_EVENT_REFRESH</code> to an object. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | <code style="color: #bb0000;"> | ||
− | + | <code style="color: #bb0000;">lv_event_send_refresh_recursive(obj)</code> sends <code style="color: #bb0000;">LV_EVENT_REFRESH</code> event to an object and all of its children. If <code style="color: #bb0000;">NULL</code> is passed as parameter all objects of all displays will be refreshed. | |
− | + | |<code style="color: #bb0000;">LV_EVENT_REFRESH</code> は、オブジェクト自体を更新するように通知するためにユーザーが使用するように設計されているため、特別なイベントです。 いくつかの例: | |
− | |||
− | |||
− | |||
− | |<code style="color: #bb0000;"> | ||
− | * | + | * 1 つまたは複数の変数 (現在の時刻など) に従ってテキストを更新するようにラベルに通知します。 |
− | * | + | * 言語が変更されたときにラベルを更新する |
− | * | + | * いくつかの条件が満たされた場合にボタンを有効にする (例: 正しい PIN が入力された) |
− | + | * 制限を超えた場合のオブジェクトへの/からのスタイルの追加/削除など | |
− | * | ||
− | |||
− | |||
+ | 同様のケースを処理する最も簡単な方法は、次の関数を利用することです。 | ||
− | + | <code style="color: #bb0000;">lv_event_send_refresh(obj)</code> は、<code style="color: #bb0000;">lv_event_send(obj, LV_EVENT_REFRESH, NULL)</code> の単なるラッパーです。 | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | したがって、<code style="color: #bb0000;">LV_EVENT_REFRESH</code> をオブジェクトに送信するだけです。 | ||
− | + | <code style="color: #bb0000;">lv_event_send_refresh_recursive(obj)</code> は、<code style="color: #bb0000;">LV_EVENT_REFRESH</code> イベントをオブジェクトとそのすべての子に送信します。 パラメータとして <code style="color: #bb0000;">NULL</code> が渡された場合、すべてのディスプレイのすべてのオブジェクトがリフレッシュされます。 | |
|} | |} | ||
:[[App:Library:LVGL:docs:Overview#Events|戻る : Previous]] | :[[App:Library:LVGL:docs:Overview#Events|戻る : Previous]] | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
2022年8月31日 (水) 20:22時点における最新版
https://docs.lvgl.io/8.2/overview/event.html
Events
英文 | 自動翻訳 |
---|---|
Events are triggered in LVGL when something happens which might be interesting to the user, e.g. when an object
|
LVGLでは、ユーザが興味を持ちそうなことが起こったときに、イベントが発生します。
|
The user can assign a callback function to an object to see these events.
In practice, it looks like this: |
ユーザーは、コールバック関数をオブジェクトに割り当てて、これらのイベントを確認できます。
実際には、次のようになります。 |
lv_obj_t * btn = lv_btn_create(lv_scr_act(), NULL);
lv_obj_set_event_cb(btn, my_event_cb); /*Assign an event callback*/
...
static void my_event_cb(lv_obj_t * obj, lv_event_t event)
{
switch(event) {
case LV_EVENT_PRESSED:
printf("Pressed\n");
break;
case LV_EVENT_SHORT_CLICKED:
printf("Short clicked\n");
break;
case LV_EVENT_CLICKED:
printf("Clicked\n");
break;
case LV_EVENT_LONG_PRESSED:
printf("Long press\n");
break;
case LV_EVENT_LONG_PRESSED_REPEAT:
printf("Long press repeat\n");
break;
case LV_EVENT_RELEASED:
printf("Released\n");
break;
}
/*Etc.*/
}
| |
More objects can use the same event callback. | より多くのオブジェクトが同じイベント コールバックを使用できます。 |
Event types
The following event types exist: | 次のイベント タイプが存在します。 |
Generic events
All objects (such as Buttons/Labels/Sliders etc.) receive these generic events regardless of their type. | すべてのオブジェクト (ボタン/ラベル/スライダーなど) は、タイプに関係なく、これらの一般的なイベントを受け取ります。 |
Related to the input devices
These are sent when an object is pressed/released etc. by the user. They are used not only for Pointers but can used for Keypad, Encoder and Button input devices as well. Visit the Overview of input devices section to learn more about them.
|
これらは、ユーザーがオブジェクトを押したり離したりしたときに送信されます。ポインターだけでなく、キーパッド、エンコーダー、ボタン入力デバイスにも使用できます。詳細については、入力デバイスの概要セクションをご覧ください。
|
Related to pointer
These events are sent only by pointer-like input devices (E.g. mouse or touchpad)
|
これらのイベントは、ポインターのような入力デバイス (マウスやタッチパッドなど) によってのみ送信されます。
|
Related to keypad and encoder
These events are sent by keypad and encoder input devices. Learn more about Groups in [overview/indev](Input devices) section.
|
これらのイベントは、キーパッドとエンコーダの入力デバイスによって送信されます。 グループの詳細については、[概要/indev](入力デバイス) セクションを参照してください。
|
General events
Other general events sent by the library.
|
図書館から送られるその他の一般的なイベント。
|
Special events
These events are specific to a particular object type.
|
これらのイベントは、特定のオブジェクト タイプに固有です。
|
Custom data
Some events might contain custom data. For example, LV_EVENT_VALUE_CHANGED in some cases tells the new value. For more information, see the particular Object type's documentation. To get the custom data in the event callback use lv_event_get_data() .
The type of the custom data depends on the sending object but if it's a
|
一部のイベントには、カスタム データが含まれる場合があります。 たとえば、場合によっては LV_EVENT_VALUE_CHANGED が新しい値を示します。 詳細については、特定のObject type's documentationを参照してください。 イベント コールバックでカスタム データを取得するには、lv_event_get_data() を使用します。
カスタム データのタイプは送信オブジェクトによって異なりますが、
|
Send events manually
Arbitrary events
To manually send events to an object, use lv_event_send(obj, LV_EVENT_..., &custom_data) .
For example, it can be used to manually close a message box by simulating a button press (although there are simpler ways of doing this): |
イベントをオブジェクトに手動で送信するには、lv_event_send(obj, LV_EVENT_..., &custom_data) を使用します。
たとえば、ボタンの押下をシミュレートすることにより、メッセージ ボックスを手動で閉じるために使用できます (ただし、これを行うより簡単な方法があります)。 |
/*Simulate the press of the first button (indexes start from zero)*/
uint32_t btn_id = 0;
lv_event_send(mbox, LV_EVENT_VALUE_CHANGED, &btn_id);
|
Refresh event
LV_EVENT_REFRESH is special event because it's designed to be used by the user to notify an object to refresh itself. Some examples:
To simplest way to handle similar cases is utilizing the following functions.
So it simply sends an
|
LV_EVENT_REFRESH は、オブジェクト自体を更新するように通知するためにユーザーが使用するように設計されているため、特別なイベントです。 いくつかの例:
同様のケースを処理する最も簡単な方法は、次の関数を利用することです。
したがって、
|