App:Library:LVGL:docs:Widgets:Message box (lv msgbox)

提供: robot-jp wiki
ナビゲーションに移動検索に移動

https://docs.lvgl.io/8.2/widgets/extra/msgbox.html

Message box (lv_msgbox)

Overview

英文 自動翻訳

The Message boxes act as pop-ups. They are built from a background container, a title, an optional close button, a text and optional buttons.

The text will be broken into multiple lines automatically and the height will be set automatically to include the text and the buttons.

The message box can be modal (blocking clicks on the rest of the screen) or not modal.

メッセージボックスはポップアップとして機能します。 これらは、背景コンテナ、タイトル、オプションの閉じるボタン、テキスト、およびオプションのボタンから構築されています。

テキストは自動的に複数の行に分割され、高さはテキストとボタンを含むように自動的に設定されます。

メッセージボックスは、モーダル(画面の残りの部分でのクリックをブロックする)またはモーダルではない場合があります。

戻る : Previous


Parts and Styles

英文 自動翻訳

The message box is built from other widgets, so you can check these widgets' documentation for details.

  • Background: lv_obj
  • Close button: lv_btn
  • Title and text: lv_label
  • Buttons: lv_btnmatrix
メッセージボックスは他のウィジェットから構築されているため、これらのウィジェットのドキュメントで詳細を確認できます。
  • Background: lv_obj
  • Close button: lv_btn
  • Title and text: lv_label
  • Buttons: lv_btnmatrix
戻る : Previous


Usage

Create a message box

英文 自動翻訳

lv_msgbox_create(parent, title, txt, btn_txts[], add_close_btn) creates a message box.


If parent is NULL the message box will be modal.


title and txt are strings for the title and the text.


btn_txts[] is an array with the buttons' text. E.g.


const char * btn_txts[] = {"Ok", "Cancel", NULL}.


add_colse_btn can be true or false to add/don't add a close button.

lv_msgbox_create(parent, title, txt, btn_txts[], add_close_btn) は、メッセージボックスを作成します。


parentNULL の場合、メッセージボックスはモーダルになります。


titletxt は、タイトルとテキストの文字列です。


btn_txts[]は、ボタンのテキストを含む配列です。 例えば、

const char * btn_txts[] = {"Ok", "Cancel", NULL}.


add_colse_btn は、閉じるボタンを追加する/追加しない場合にtrueまたはfalse になります。

戻る : Previous


Get the parts

英文 自動翻訳

The building blocks of the message box can be obtained using the following functions:

 lv_obj_t * lv_msgbox_get_title(lv_obj_t * mbox);
 lv_obj_t * lv_msgbox_get_close_btn(lv_obj_t * mbox);
 lv_obj_t * lv_msgbox_get_text(lv_obj_t * mbox);
 lv_obj_t * lv_msgbox_get_btns(lv_obj_t * mbox);
メッセージボックスの構成要素は、次の関数を使用して取得できます。
 lv_obj_t * lv_msgbox_get_title(lv_obj_t * mbox);
 lv_obj_t * lv_msgbox_get_close_btn(lv_obj_t * mbox);
 lv_obj_t * lv_msgbox_get_text(lv_obj_t * mbox);
 lv_obj_t * lv_msgbox_get_btns(lv_obj_t * mbox);
戻る : Previous

Close the message box

英文 自動翻訳

lv_msgbox_close(msgbox) closes (deletes) the message box.

lv_msgbox_close(msgbox) は、メッセージボックスを閉じます(削除します)。
戻る : Previous


Events

英文 自動翻訳
  • LV_EVENT_VALUE_CHANGED is sent by the buttons if one of them is clicked. LV_OBJ_FLAG_EVENT_BUBBLE is enabled on the buttons so you can add events to the message box itself. In the event handler, lv_event_get_target(e) will return the button matrix and lv_event_get_current_target(e) will return the message box. lv_msgbox_get_active_btn(msgbox) and lv_msgbox_get_active_btn_text(msgbox) can be used to get the index and text of the clicked button.


Learn more about Events.

  • LV_EVENT_VALUE_CHANGED は、ボタンの1つがクリックされた場合に、ボタンによって送信されます。ボタンでLV_OBJ_FLAG_EVENT_BUBBLE が有効になっているため、メッセージボックス自体にイベントを追加できます。 イベントハンドラーでは、lv_event_get_target(e)はボタンマトリックスを返し、lv_event_get_current_target(e) はメッセージボックスを返します。lv_msgbox_get_active_btn(msgbox)lv_msgbox_get_active_btn_text(msgbox) を使用して、クリックしたボタンのインデックスとテキストを取得できます。


イベントの詳細を確認してください。

戻る : Previous


Keys

英文 自動翻訳

Keys have effect on the close button and button matrix. You can add them manually to a group if required.

Learn more about Keys.

キーは、閉じるボタンとボタンのマトリックスに影響します。必要に応じて、グループに手動で追加できます。

キーの詳細を確認してください。

戻る : Previous


Example

英文 自動翻訳

Simple Message box

LVGL docs example 098.png

戻る : Previous


API

英文 自動翻訳

Functions

lv_obj_t *lv_msgbox_create(lv_obj_t *parent, const char *title, const char *txt, const char *btn_txts[], bool add_close_btn)

Create a message box object
Parameters
  • parent -- pointer to parent or NULL to create a full screen modal message box
  • title -- the title of the message box
  • txt -- the text of the message box
  • btn_txts -- the buttons as an array of texts terminated by an "" element. E.g. {"btn1", "btn2", ""}
  • add_close_btn -- true: add a close button
Returns
pointer to the message box object

lv_obj_t *lv_msgbox_get_title(lv_obj_t *obj)

lv_obj_t *lv_msgbox_get_close_btn(lv_obj_t *obj)

lv_obj_t *lv_msgbox_get_text(lv_obj_t *obj)

lv_obj_t *lv_msgbox_get_content(lv_obj_t *obj)

lv_obj_t *lv_msgbox_get_btns(lv_obj_t *obj)

uint16_t lv_msgbox_get_active_btn(lv_obj_t *mbox)

Get the index of the selected button
Parameters
mbox -- message box object
Returns
index of the button (LV_BTNMATRIX_BTN_NONE: if unset)

const char *lv_msgbox_get_active_btn_text(lv_obj_t *mbox)

void lv_msgbox_close(lv_obj_t *mbox)

void lv_msgbox_close_async(lv_obj_t *mbox)

Variables

const lv_obj_class_t lv_msgbox_class

const lv_obj_class_t lv_msgbox_content_class

const lv_obj_class_t lv_msgbox_backdrop_class

struct lv_msgbox_t

Public Members
lv_obj_t obj
lv_obj_t *title
lv_obj_t *close_btn
lv_obj_t *content
lv_obj_t *text
lv_obj_t *btns
Functions

lv_obj_t *lv_msgbox_create(lv_obj_t *parent, const char *title, const char *txt, const char *btn_txts[], bool add_close_btn)

メッセージボックスオブジェクトを作成する
Parameters
  • parent -- 親へのポインタまたはフルスクリーンのモーダルメッセージボックスを作成するためのNULL
  • title -- メッセージボックスのタイトル
  • txt -- メッセージボックスのテキスト
  • btn_txts -- "要素で終了するテキストの配列としてのボタン。例えば。 {"btn1", "btn2", ""}
  • add_close_btn -- true: 閉じるボタンを追加します
Returns
メッセージボックスオブジェクトへのポインタ

lv_obj_t *lv_msgbox_get_title(lv_obj_t *obj)

lv_obj_t *lv_msgbox_get_close_btn(lv_obj_t *obj)

lv_obj_t *lv_msgbox_get_text(lv_obj_t *obj)

lv_obj_t *lv_msgbox_get_content(lv_obj_t *obj)

lv_obj_t *lv_msgbox_get_btns(lv_obj_t *obj)

uint16_t lv_msgbox_get_active_btn(lv_obj_t *mbox)

選択したボタンのインデックスを取得します
Parameters
mbox -- メッセージボックスオブジェクト
Returns
ボタンのインデックス (LV_BTNMATRIX_BTN_NONE: if unset)

const char *lv_msgbox_get_active_btn_text(lv_obj_t *mbox)

void lv_msgbox_close(lv_obj_t *mbox)

void lv_msgbox_close_async(lv_obj_t *mbox)

Variables

const lv_obj_class_t lv_msgbox_class

const lv_obj_class_t lv_msgbox_content_class

const lv_obj_class_t lv_msgbox_backdrop_class

struct lv_msgbox_t

Public Members
lv_obj_t obj
lv_obj_t *title
lv_obj_t *close_btn
lv_obj_t *content
lv_obj_t *text
lv_obj_t *btns


戻る : Previous