App:Library:LVGL:docs:Widgets:Button matrix (lv btnmatrix)

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

https://docs.lvgl.io/8.2/widgets/core/arc.html

Button matrix (lv_btnmatrix)

Overview

英文 自動翻訳

The Button Matrix object is a lightweight way to display multiple buttons in rows and columns. Lightweight because the buttons are not actually created but just virtually drawn on the fly. This way, one button use only eight extra bytes of memory instead of the ~100-150 bytes a normal Button object plus the 100 or so bytes for the Label object.


The Button matrix is added to the default group (if one is set). Besides the Button matrix is an editable object to allow selecting and clicking the buttons with encoder navigation too.

Button Matrixオブジェクトは、行と列に複数のボタンを表示するための軽量な方法です。ボタンは実際には作成されておらず、仮想的にその場で描画されるため、軽量です。このように、1つのボタンは通常のButtonオブジェクトの約100〜150バイトとLabelオブジェクトの100バイト程度の代わりに、8バイトの追加メモリのみを使用します。


Buttonマトリックスがデフォルトグループに追加されます(設定されている場合)。ボタンマトリックスに加えて、エンコーダナビゲーションでボタンを選択してクリックできるようにする編集可能なオブジェクトもあります。

戻る : Previous


Parts and Styles

英文 自動翻訳
  • LV_PART_MAIN The background of the button matrix, uses the typical background style properties. pad_row and pad_column sets the space between the buttons.
  • LV_PART_ITEMS The buttons all use the text and typical background style properties except translations and transformations.
  • LV_PART_MAIN button matrixの背景は、一般的な背景スタイルのプロパティを使用します。pad_rowpad_columnは、ボタン間のスペースを設定します。
  • LV_PART_ITEMSボタンはすべて、翻訳と変換を除いて、テキストと一般的な背景スタイルのプロパティを使用します。
戻る : Previous


Usage

Button's text

英文 自動翻訳

There is a text on each button.

To specify them a descriptor string array, called map, needs to be used.

The map can be set with lv_btnmatrix_set_map(btnm, my_map).

The declaration of a map should look like const char * map[] = {"btn1", "btn2", "btn3", NULL}.

Note that the last element has to be either NULL or an empty string ("")!


Use "\n" in the map to insert a line break.

E.g. {"btn1", "btn2", "\n", "btn3", ""}.

Each line's buttons have their width calculated automatically.

So in the example the first row will have 2 buttons each with 50% width and a second row with 1 button having 100% width.

各ボタンにはテキストがあります。

それらを指定するには、 mapと呼ばれる記述子文字列配列を使用する必要があります。

マップはlv_btnmatrix_set_map(btnm, my_map)で設定できます。

マップの宣言はconst char * map[] = {"btn1", "btn2", "btn3", NULL}のようになります。

最後の要素は、NULLまたは空の文字列("")である必要があることに注意してください。


"\n"は、マップ内に改行を挿入するために 使用します。

例えば、{"btn1", "btn2", "\n", "btn3", ""}

各行のボタンの幅は自動的に計算されます。

したがって、この例では、最初の行にはそれぞれ50%の幅の2つのボタンがあり、2番目の行には100%の幅の1つのボタンがあります。

戻る : Previous


Control buttons

英文 自動翻訳

The buttons' width can be set relative to the other button in the same row with lv_btnmatrix_set_btn_width(btnm, btn_id, width)

E.g. in a line with two buttons: btnA, width = 1 and btnB, width = 2, btnA will have 33 % width and btnB will have 66 % width.

It's similar to how the flex-grow property works in CSS.

The width must be in the [1..7] range and the default width is 1.


In addition to the width, each button can be customized with the following parameters:

  • LV_BTNMATRIX_CTRL_HIDDEN Makes a button hidden (hidden buttons still take up space in the layout, they are just not visible or clickable)
  • LV_BTNMATRIX_CTRL_NO_REPEAT Disable repeating when the button is long pressed
  • LV_BTNMATRIX_CTRL_DISABLED Makes a button disabled Like LV_STATE_DISABLED on normal objects
  • LV_BTNMATRIX_CTRL_CHECKABLE Enable toggling of a button. I.e. LV_STATE_CHECHED will be added/removed as the button is clicked
  • LV_BTNMATRIX_CTRL_CHECKED Make the button checked. It will use the LV_STATE_CHECHKED styles.
  • LV_BTNMATRIX_CTRL_CLICK_TRIG Enabled: send LV_EVENT_VALUE_CHANGE on CLICK, Disabled: send LV_EVENT_VALUE_CHANGE on PRESS
  • LV_BTNMATRIX_CTRL_POPOVER Show the button label in a popover when pressing this key
  • LV_BTNMATRIX_CTRL_RECOLOR Enable recoloring of button texts with #. E.g. "It's #ff0000 red#"
  • LV_BTNMATRIX_CTRL_CUSTOM_1 Custom free to use flag
  • LV_BTNMATRIX_CTRL_CUSTOM_2 Custom free to use flag


By default, all flags are disabled.

To set or clear a button's control attribute, use lv_btnmatrix_set_btn_ctrl(btnm, btn_id, LV_BTNM_CTRL_...) and lv_btnmatrix_clear_btn_ctrl(btnm, btn_id, LV_BTNMATRIX_CTRL_...) respectively.

More LV_BTNM_CTRL_... values can be OR-ed


To set/clear the same control attribute for all buttons of a button matrix, use lv_btnmatrix_set_btn_ctrl_all(btnm, LV_BTNM_CTRL_...) and lv_btnmatrix_clear_btn_ctrl_all(btnm, LV_BTNMATRIX_CTRL_...).

The set a control map for a button matrix (similarly to the map for the text), use lv_btnmatrix_set_ctrl_map(btnm, ctrl_map).

An element of ctrl_map should look like ctrl_map[0] = width | LV_BTNM_CTRL_NO_REPEAT |  LV_BTNM_CTRL_CHECHKABLE.

The number of elements should be equal to the number of buttons (excluding newlines characters).

ボタンの幅は、同じ行の他のボタンlv_btnmatrix_set_btn_width(btnm, btn_id, width)を基準にして設定できます。

たとえば、btnA、幅= 1およびbtnB、幅= 2btnAの幅は33%、btnBの幅は66%になります。

それは、CSSのflex-growプロパティの動作に似ています。

幅は[1..7]の範囲内である必要があり、デフォルトの幅は1です。

幅に加えて、各ボタンは次のパラメータでカスタマイズできます。

  • LV_BTNMATRIX_CTRL_HIDDENボタンを非表示にします(非表示のボタンはレイアウト内のスペースを占有し、表示またはクリックできないだけです)
  • LV_BTNMATRIX_CTRL_NO_REPEATボタンを長押ししたときに繰り返しを無効にする
  • LV_BTNMATRIX_CTRL_DISABLEDButton Matrixオブジェクトは、行と列に複数のボタンを表示するための軽量な方法です。ボタンは実際には作成されておらず、仮想的にその場で描画されるため、軽量です。このように、1つのボタンは通常のButtonオブジェクトの約100〜150バイトとLabelオブジェクトの100バイト程度の代わりに、8バイトの追加メモリのみを使用します。LV_STATE_DISABLED通常のオブジェクトと同様にボタンを無効にします
  • LV_BTNMATRIX_CTRL_CHECKABLEボタンの切り替えを有効にします。つまりLV_STATE_CHECHED、ボタンがクリックされると追加/削除されます
  • LV_BTNMATRIX_CTRL_CHECKEDボタンをチェックします。LV_STATE_CHECHKEDスタイルを使用します。
  • LV_BTNMATRIX_CTRL_CLICK_TRIG有効:クリックでLV_EVENT_VALUE_CHANGEを送信、無効:プレスでLV_EVENT_VALUE_CHANGEを送信
  • LV_BTNMATRIX_CTRL_POPOVERこのキーを押すと、ポップオーバーにボタンラベルが表示されます
  • LV_BTNMATRIX_CTRL_RECOLORでボタンテキストの色の変更を有効にします#。例えば"It's #ff0000 red#"
  • LV_BTNMATRIX_CTRL_CUSTOM_1カスタムの自由に使用できるフラグ
  • LV_BTNMATRIX_CTRL_CUSTOM_2カスタムの自由に使用できるフラグ

デフォルトでは、すべてのフラグが無効になっています。

ボタンの制御属性を設定またはクリアするには、lv_btnmatrix_set_btn_ctrl(btnm, btn_id, LV_BTNM_CTRL_...)lv_btnmatrix_clear_btn_ctrl(btnm, btn_id, LV_BTNMATRIX_CTRL_...)を使用します。

より多くのLV_BTNM_CTRL_...の値をOR演算できます


ボタンマトリックスのすべてのボタンに同じコントロール属性を設定/クリアするには、lv_btnmatrix_set_btn_ctrl_all(btnm, LV_BTNM_CTRL_...)lv_btnmatrix_clear_btn_ctrl_all(btnm, LV_BTNMATRIX_CTRL_...)を使用します。

ボタンマトリックスのコントロールマップを設定するには(テキストのマップと同様)lv_btnmatrix_set_ctrl_map(btnm, ctrl_map)を使用します。

ctrl_mapの要素はctrl_map[0] = width | LV_BTNM_CTRL_NO_REPEAT |  LV_BTNM_CTRL_CHECHKABLEのようになります。

要素の数は、ボタンの数と同じである必要があります(改行文字を除く)。

戻る : Previous


One check

英文 自動翻訳

The "One check" feature can be enabled with lv_btnmatrix_set_one_checked(btnm, true) to allow only one button to be checked at a time.

lv_btnmatrix_set_one_checked(btnm, true)により「ワンチェック」機能を有効にすると、一度に1つのボタンのみをチェックできます。
戻る : Previous


Events

英文 自動翻訳
  • LV_EVENT_VALUE_CHANGED Sent when a button is pressed/released or repeated after long press. The event parameter is set to the ID of the pressed/released button.
  • LV_EVENT_DRAW_PART_BEGIN and LV_EVENT_DRAW_PART_END are sent for the following types:
    • LV_BTNMATRIX_DRAW_PART_BTN The individual buttons.
      • part: LV_PART_ITEMS
      • id:index of the button being drawn
      • draw_area: the area of teh button
      • rect_dsc


See the events of the Base object too.

lv_btnmatrix_get_selected_btn(btnm) returns the index of the most recently released or focused button or LV_BTNMATRIX_BTN_NONE if no such button.

lv_btnmatrix_get_btn_text(btnm, btn_id) returns a pointer to the text of btn_idth button.

Learn more about Events.

  • LV_EVENT_VALUE_CHANGEDボタンを長押しした後、ボタンを押したり離したり、繰り返したりしたときに送信されます。イベントパラメータは、押された/離されたボタンのIDに設定されます。
  • LV_EVENT_DRAW_PART_BEGINButton Matrixオブジェクトは、行と列に複数のボタンを表示するための軽量な方法です。ボタンは実際には作成されておらず、仮想的にその場で描画されるため、軽量です。このように、1つのボタンは通常のButtonオブジェクトの約100〜150バイトとLabelオブジェクトの100バイト程度の代わりに、8バイトの追加メモリのみを使用します。LV_EVENT_DRAW_PART_END次のタイプで送信されます 。
    • LV_BTNMATRIX_DRAW_PART_BTN個々のボタン。
      • part: LV_PART_ITEMS
      • id:描画されているボタンのインデックス
      • draw_area:ボタンの面積
      • rect_dsc

Baseオブジェクトのイベントも参照してください。

lv_btnmatrix_get_selected_btn(btnm)は、最近リリースまたはフォーカスされたボタンのインデックスを返すか、そのようなボタンがない場合にはLV_BTNMATRIX_BTN_NONEを返します。


lv_btnmatrix_get_btn_text(btnm, btn_id)ボタンbtn_idの中のテキストへのポインタを返します。

イベントの詳細をご覧ください。

戻る : Previous


Keys

英文 自動翻訳
  • LV_KEY_RIGHT/UP/LEFT/RIGHT To navigate among the buttons to select one
  • LV_KEY_ENTER To press/release the selected button


Learn more about Keys.

  • LV_KEY_RIGHT/UP/LEFT/RIGHTボタン間を移動するため、一つを選択します。
  • LV_KEY_ENTER選択したボタンを押す/離します。


キーの詳細をご覧ください。

戻る : Previous


Example

英文 自動翻訳

Simple Button matrix

LVGL docs example 055.png

Custom buttons

LVGL docs example 056.png

Pagination

LVGL docs example 057.png

戻る : Previous


API

英文 自動翻訳

Typedefs

typedef uint16_t lv_btnmatrix_ctrl_t

typedef bool (*lv_btnmatrix_btn_draw_cb_t)(lv_obj_t *btnm, uint32_t btn_id, const lv_area_t *draw_area, const lv_area_t *clip_area)



Enums

enum [anonymous]

Type to store button control bits (disabled, hidden etc.) The first 3 bits are used to store the width Values:
enumerator _LV_BTNMATRIX_WIDTH
Reserved to stire the size units
enumerator LV_BTNMATRIX_CTRL_HIDDEN
Button hidden
enumerator LV_BTNMATRIX_CTRL_NO_REPEAT
Do not repeat press this button.
enumerator LV_BTNMATRIX_CTRL_DISABLED
Disable this button.
enumerator LV_BTNMATRIX_CTRL_CHECKABLE
The button can be toggled.
enumerator LV_BTNMATRIX_CTRL_CHECKED
Button is currently toggled (e.g. checked).
enumerator LV_BTNMATRIX_CTRL_CLICK_TRIG
1: Send LV_EVENT_VALUE_CHANGE on CLICK, 0: Send LV_EVENT_VALUE_CHANGE on PRESS
enumerator LV_BTNMATRIX_CTRL_POPOVER
Show a popover when pressing this key
enumerator LV_BTNMATRIX_CTRL_RECOLOR
Enable text recoloring with #color
enumerator _LV_BTNMATRIX_CTRL_RESERVED
Reserved for later use
enumerator LV_BTNMATRIX_CTRL_CUSTOM_1
Custom free to use flag
enumerator LV_BTNMATRIX_CTRL_CUSTOM_2
Custom free to use flag

enum lv_btnmatrix_draw_part_type_t

type field in lv_obj_draw_part_dsc_t if class_p = lv_btnmatrix_class Used in LV_EVENT_DRAW_PART_BEGIN and LV_EVENT_DRAW_PART_END
Values:
enumerator LV_BTNMATRIX_DRAW_PART_BTN
The rectangle and label of buttons


Functions

LV_EXPORT_CONST_INT(LV_BTNMATRIX_BTN_NONE)

lv_obj_t *lv_btnmatrix_create(lv_obj_t *parent)

Create a button matrix object
Parameters
parent -- pointer to an object, it will be the parent of the new button matrix
Returns
pointer to the created button matrix

void lv_btnmatrix_set_map(lv_obj_t *obj, const char *map[])

Set a new map. Buttons will be created/deleted according to the map. The button matrix keeps a reference to the map and so the string array must not be deallocated during the life of the matrix.
Parameters
  • obj -- pointer to a button matrix object
  • map -- pointer a string array. The last string has to be: "". Use "\n" to make a line break.


void lv_btnmatrix_set_ctrl_map(lv_obj_t *obj, const lv_btnmatrix_ctrl_t ctrl_map[])

Set the button control map (hidden, disabled etc.) for a button matrix. The control map array will be copied and so may be deallocated after this function returns.
Parameters
  • obj -- pointer to a button matrix object
  • ctrl_map -- pointer to an array of lv_btn_ctrl_t control bytes. The length of the array and position of the elements must match the number and order of the individual buttons (i.e. excludes newline entries). An element of the map should look like e.g.: ctrl_map[0] = width | LV_BTNMATRIX_CTRL_NO_REPEAT | LV_BTNMATRIX_CTRL_TGL_ENABLE


void lv_btnmatrix_set_selected_btn(lv_obj_t *obj, uint16_t btn_id)

Set the selected buttons
Parameters
  • obj -- pointer to button matrix object
  • btn_id -- 0 based index of the button to modify. (Not counting new lines)


void lv_btnmatrix_set_btn_ctrl(lv_obj_t *obj, uint16_t btn_id, lv_btnmatrix_ctrl_t ctrl)

Set the attributes of a button of the button matrix
Parameters
  • obj -- pointer to button matrix object
  • btn_id -- 0 based index of the button to modify. (Not counting new lines)
  • ctrl -- OR-ed attributs. E.g. LV_BTNMATRIX_CTRL_NO_REPEAT | LV_BTNMATRIX_CTRL_CHECKABLE


void lv_btnmatrix_clear_btn_ctrl(lv_obj_t *obj, uint16_t btn_id, lv_btnmatrix_ctrl_t ctrl)

Clear the attributes of a button of the button matrix
Parameters
  • obj -- pointer to button matrix object
  • btn_id -- 0 based index of the button to modify. (Not counting new lines)
  • ctrl -- OR-ed attributs. E.g. LV_BTNMATRIX_CTRL_NO_REPEAT | LV_BTNMATRIX_CTRL_CHECKABLE


void lv_btnmatrix_set_btn_ctrl_all(lv_obj_t *obj, lv_btnmatrix_ctrl_t ctrl)

Set attributes of all buttons of a button matrix
Parameters
  • obj -- pointer to a button matrix object
  • ctrl -- attribute(s) to set from lv_btnmatrix_ctrl_t. Values can be ORed.


void lv_btnmatrix_clear_btn_ctrl_all(lv_obj_t *obj, lv_btnmatrix_ctrl_t ctrl)

Clear the attributes of all buttons of a button matrix
Parameters
  • obj -- pointer to a button matrix object
  • ctrl -- attribute(s) to set from lv_btnmatrix_ctrl_t. Values can be ORed.
  • en -- true: set the attributesfalse: clear the attributes


void lv_btnmatrix_set_btn_width(lv_obj_t *obj, uint16_t btn_id, uint8_t width)

Set a single button's relative width. This method will cause the matrix be regenerated and is a relatively expensive operation. It is recommended that initial width be specified using lv_btnmatrix_set_ctrl_map and this method only be used for dynamic changes.
Parameters
  • obj -- pointer to button matrix object
  • btn_id -- 0 based index of the button to modify.
  • width -- relative width compared to the buttons in the same row. [1..7]


void lv_btnmatrix_set_one_checked(lv_obj_t *obj, bool en)

Make the button matrix like a selector widget (only one button may be checked at a time). LV_BTNMATRIX_CTRL_CHECKABLE must be enabled on the buttons to be selected using lv_btnmatrix_set_ctrl() or lv_btnmatrix_set_btn_ctrl_all().
Parameters
  • obj -- pointer to a button matrix object
  • en -- whether "one check" mode is enabled


const char **lv_btnmatrix_get_map(const lv_obj_t *obj)

Get the current map of a button matrix
Parameters
obj -- pointer to a button matrix object
Returns
the current map


uint16_t lv_btnmatrix_get_selected_btn(const lv_obj_t *obj)

Get the index of the lastly "activated" button by the user (pressed, released, focused etc) Useful in the event_cb to get the text of the button, check if hidden etc.
Parameters
obj -- pointer to button matrix object
Returns
index of the last released button (LV_BTNMATRIX_BTN_NONE: if unset)


const char *lv_btnmatrix_get_btn_text(const lv_obj_t *obj, uint16_t btn_id)

Get the button's text
Parameters
  • obj -- pointer to button matrix object
  • btn_id -- the index a button not counting new line characters.
Returns
text of btn_index` button


bool lv_btnmatrix_has_btn_ctrl(lv_obj_t *obj, uint16_t btn_id, lv_btnmatrix_ctrl_t ctrl)

Get the whether a control value is enabled or disabled for button of a button matrix
Parameters
  • obj -- pointer to a button matrix object
  • btn_id -- the index of a button not counting new line characters.
  • ctrl -- control values to check (ORed value can be used)
Returns
true: the control attribute is enabled false: disabled


bool lv_btnmatrix_get_one_checked(const lv_obj_t *obj)

Tell whether "one check" mode is enabled or not.
Parameters
obj -- Button matrix object
Returns
true: "one check" mode is enabledfalse: disabled


Variables

const lv_obj_class_t lv_btnmatrix_class

struct lv_btnmatrix_t

Public Members
lv_obj_t obj
const char **map_p
lv_area_t *button_areas
lv_btnmatrix_ctrl_t *ctrl_bits
uint16_t btn_cnt
uint16_t row_cnt
uint16_t btn_id_sel
uint8_t one_check


Typedef

typedef uint16_t lv_btnmatrix_ctrl_t

typedef bool(* lv_btnmatrix_btn_draw_cb_t)(lv_obj_t * btnm、uint32_t btn_id、const lv_area_t * draw_area、const lv_area_t * clip_area)

列挙型

列挙型[匿名]

ボタン制御ビットを格納するためのタイプ(無効、非表示など)最初の3ビットは、幅の 値を格納するために使用されます。
列挙子_LV_BTNMATRIX_WIDTH
サイズ単位を固定するために予約済み
列挙子LV_BTNMATRIX_CTRL_HIDDEN
ボタンを非表示
列挙子LV_BTNMATRIX_CTRL_NO_REPEAT
このボタンを繰り返し押さないでください。
列挙子LV_BTNMATRIX_CTRL_DISABLED
このボタンを無効にします。
列挙子LV_BTNMATRIX_CTRL_CHECKABLE
ボタンは切り替えることができます。
列挙子LV_BTNMATRIX_CTRL_CHECKED
ボタンは現在切り替えられています(たとえば、チェックされています)。
列挙子LV_BTNMATRIX_CTRL_CLICK_TRIG
1:クリックでLV_EVENT_VALUE_CHANGEを送信、0:プレスでLV_EVENT_VALUE_CHANGEを送信
列挙子LV_BTNMATRIX_CTRL_POPOVER
このキーを押すとポップオーバーを表示します
列挙子LV_BTNMATRIX_CTRL_RECOLOR
でテキストの色変更を有効にする#color
列挙子_LV_BTNMATRIX_CTRL_RESERVED
後で使用するために予約済み
列挙子LV_BTNMATRIX_CTRL_CUSTOM_1
カスタムの自由に使用できるフラグ
列挙子LV_BTNMATRIX_CTRL_CUSTOM_2
カスタムの自由に使用できるフラグ

列挙型lv_btnmatrix_draw_part_type_t

もしclass_p = lv_btnmatrix_classLV_EVENT_DRAW_PART_BEGINLV_EVENT_DRAW_PART_END
の中で使用された時の、lv_obj_draw_part_dsc_tの中のtypeフィールド
値:
列挙子LV_BTNMATRIX_DRAW_PART_BTN
ボタンの長方形とラベル

機能

LV_EXPORT_CONST_INT(LV_BTNMATRIX_BTN_NONE)

lv_obj_t * lv_btnmatrix_create(lv_obj_t * parent)

ボタンマトリックスオブジェクトを作成する
パラメーター
parent-オブジェクトへのポインタ。新しいボタンマトリックスの親になります。
戻り値
作成されたボタンマトリックスへのポインタ

void lv_btnmatrix_set_map(lv_obj_t * obj、const char * map [])

新しいマップを設定します。ボタンはマップに従って作成/削除されます。ボタンマトリックスはマップへの参照を保持するため、マトリックスの存続期間中は文字列配列の割り当てを解除しないでください。
パラメーター
  • obj-ボタンマトリックスオブジェクトへのポインタ
  • map-文字列配列へのポインタ。最後の文字列は "" である必要があります。"\n" を使用して改行します。

void lv_btnmatrix_set_ctrl_map(lv_obj_t * obj、const lv_btnmatrix_ctrl_t ctrl_map [])

ボタンマトリックスのボタンコントロールマップ(非表示、無効など)を設定します。コントロールマップ配列がコピーされるため、この関数が戻った後に割り当てが解除される場合があります。
パラメーター
  • obj-ボタンマトリックスオブジェクトへのポインタ
  • ctrl_map-lv_btn_ctrl_tのコントロールバイト配列へのポインター。配列の長さと要素の位置は、個々のボタンの数と順序と一致する必要があります(つまり、改行エントリは除外されます)。マップの要素は次のようになります。ctrl_map[0] = width | LV_BTNMATRIX_CTRL_NO_REPEAT | LV_BTNMATRIX_CTRL_TGL_ENABLE

void lv_btnmatrix_set_selected_btn(lv_obj_t * obj、uint16_t btn_id)

選択したボタンを設定する
パラメーター
  • obj-ボタンマトリックスオブジェクトへのポインタ
  • btn_id -0ベースの変更するボタンのインデックス。(新しい行はカウントされません)

void lv_btnmatrix_set_btn_ctrl(lv_obj_t * obj、uint16_t btn_id、lv_btnmatrix_ctrl_t ctrl)

ボタンマトリックスのボタンの属性を設定します
パラメーター
  • obj-ボタンマトリックスオブジェクトへのポインタ
  • btn_id -0ベースの変更するボタンのインデックス。(新しい行はカウントされません)
  • ctrl -OR-ed属性。例えばLV_BTNMATRIX_CTRL_NO_REPEAT | LV_BTNMATRIX_CTRL_CHECKABLE

void lv_btnmatrix_clear_btn_ctrl(lv_obj_t * obj、uint16_t btn_id、lv_btnmatrix_ctrl_t ctrl)

ボタンマトリックスのボタンの属性をクリアします
パラメーター
  • obj-ボタンマトリックスオブジェクトへのポインタ
  • btn_id -0ベースの変更するボタンのインデックス。(新しい行はカウントされません)
  • ctrl -OR-ed属性。例えばLV_BTNMATRIX_CTRL_NO_REPEAT | LV_BTNMATRIX_CTRL_CHECKABLE

void lv_btnmatrix_set_btn_ctrl_all(lv_obj_t * obj、lv_btnmatrix_ctrl_t ctrl)

ボタンマトリックスのすべてのボタンの属性を設定する
パラメーター
  • obj-ボタンマトリックスオブジェクトへのポインタ
  • ctrl-lv_btnmatrix_ctrl_tから設定する属性。値はOR演算できます。

void lv_btnmatrix_clear_btn_ctrl_all(lv_obj_t * obj、lv_btnmatrix_ctrl_t ctrl)

ボタンマトリックスのすべてのボタンの属性をクリアします
パラメーター
  • obj-ボタンマトリックスオブジェクトへのポインタ
  • ctrl-から設定する属性lv_btnmatrix_ctrl_t。値はOR演算できます。
  • en --true:属性を設定しますfalse:属性をクリアします

void lv_btnmatrix_set_btn_width(lv_obj_t * obj、uint16_t btn_id、uint8_t width)

1つのボタンの相対的な幅を設定します。この方法では、マトリックスが再生成され、比較的コストのかかる操作になります。初期幅はlv_btnmatrix_set_ctrl_mapを使用して指定することをお勧めします。この方法は、動的な変更にのみ使用してください。
パラメーター
  • obj-ボタンマトリックスオブジェクトへのポインタ
  • btn_id -0ベースの変更するボタンのインデックス。
  • width-同じ行のボタンと比較した相対的な幅[1..7]

void lv_btnmatrix_set_one_checked(lv_obj_t * obj、bool en)

ボタンマトリックスをセレクターウィジェットのように作成します(一度にチェックできるボタンは1つだけです)。LV_BTNMATRIX_CTRL_CHECKABLEは、lv_btnmatrix_set_ctrl()又はlv_btnmatrix_set_btn_ctrl_all()を使用して選択されたボタンで有効にする必要があります
パラメーター
  • obj-ボタンマトリックスオブジェクトへのポインタ
  • ja-「ワンチェック」モードが有効かどうか

const char ** lv_btnmatrix_get_map(const lv_obj_t * obj)

ボタンマトリックスの現在のマップを取得します
パラメーター
obj-ボタンマトリックスオブジェクトへのポインタ
戻り値
現在の地図

uint16_t lv_btnmatrix_get_selected_btn(const lv_obj_t * obj)

ユーザーが最後に「アクティブ化した」ボタンのインデックスを取得します(押された、離された、フォーカスされたなど)。event_cbの中でボタンのテキストを取得したり、非表示になっているかどうかを確認したりするのに便利です。
パラメーター
obj-ボタンマトリックスオブジェクトへのポインタ
戻り値
最後にリリースされたボタンのインデックス(LV_BTNMATRIX_BTN_NONE:設定されていない場合)

const char * lv_btnmatrix_get_btn_text(const lv_obj_t * obj、uint16_t btn_id)

ボタンのテキストを取得する
パラメーター
  • obj-ボタンマトリックスオブジェクトへのポインタ
  • btn_id-改行文字をカウントしないボタンのインデックス。
戻り値
btn_index`ボタンのテキスト

bool lv_btnmatrix_has_btn_ctrl(lv_obj_t * obj、uint16_t btn_id、lv_btnmatrix_ctrl_t ctrl)

ボタンマトリックスのボタンの制御値が有効か無効かを取得します
パラメーター
  • obj-ボタンマトリックスオブジェクトへのポインタ
  • btn_id-改行文字をカウントしないボタンのインデックス。
  • ctrl-チェックする制御値(ORされた値を使用できます)
戻り値
true:制御属性が有効になっているfalse:無効になっている

bool lv_btnmatrix_get_one_checked(const lv_obj_t * obj)

「ワンチェック」モードが有効になっているかどうかを確認します。
パラメーター
obj-ボタンマトリックスオブジェクト
戻り値
true:「ワンチェック」モードが有効になっていますfalse:無効になっています

変数

const lv_obj_class_t lv_btnmatrix_class

struct lv_btnmatrix_t

パブリックメンバー
lv_obj_t obj
const char ** map_p
lv_area_t * button_areas
lv_btnmatrix_ctrl_t * ctrl_bits
uint16_t btn_cnt
uint16_t row_cnt
uint16_t btn_id_sel
uint8_t one_check


戻る : Previous