array

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决
1,164 次查看
abs_setian
Contributor II

Hello,

I wanna make array of widget(such as button, label..and so on)

Are there any way to make array for widget in GUI GUIDER?

I used to array like this 

for (index = 0; index < 7; index++) {
		if (GFX_lv_btn_get_state(guider_ui.Setting_schedule_add_repeat_imgbtn_day[index].obj) == GFX_LV_BTN_STATE_CHECKED_RELEASED) {
			repeat |= (1 << index);
		}
	}

Is there a way to group multiple widgets into a single array in C language?

is there a way to modify the automatically generated files in GUI GUIDER, excluding the custom file?

0 项奖励
回复
1 解答
1,062 次查看
EdwinHz
NXP TechSupport
NXP TechSupport

Hi @abs_setian,

I'm not quite sure I understand the reasoning behind a hidden 3rd row, but I believe the situation you are presenting is about positioning each row relative to the previous row or to the container as a whole. If this is the case, you could use percentage values to align each label to a relative position of the container rather than a specific coordinate, or the lv_obj_align_to() function to align an object relative to another object. Both of these possibilities are described on the following site: Positions, sizes, and layouts — LVGL documentation

With respect to identifying child objects within the container, the simplest way to do so in GUI Guider would be to pay attention to the order that the objects are arranged on the Widgets menu. This menu arranges children by descending order. Therefore, for this arrangement of the labels inside of the container:

EdwinHz_1-1713313816875.png

  • Label_1 is child 0
  • Label_2 is child 1
  • Label_3 is child 2
  • Label_4 is child 3

If the number of labels inside a container is too large, you could also nest containers inside of the main container, which would allow referencing for each label to be similar to a grid. The first layer of child object would be the row, while the second layer of child objects would be the column. For example:

EdwinHz_2-1713314937134.pngEdwinHz_3-1713314968641.png

In this case, child 0 of the child 0 of the main container would be label "x0y0", and child 2 of child 1 of the main container would be label "x2y1".

I hope this helps!

BR,
Edwin.

在原帖中查看解决方案

4 回复数
1,096 次查看
EdwinHz
NXP TechSupport
NXP TechSupport

Hi @abs_setian,

Perhaps the Container widget might just be what you are looking for. This widget is a simple object that is used to encapsulate and group several other widgets of any time inside of it and maintain them organized with a specific layout. It could contain an array of buttons, labels, images, etc. It can also contain a mixed combination of widgets. Any widgets inside of the container will be considered to be grouped and can be moved or transformed in conjunction.

If what you need is specifically an array of buttons, then the widget to use would be a Button Matrix. It is quite similar to the container, but optimized for button usage, and it consumes less memory than a container with buttons.

With respect to the automatically generated files, GUI Guider will replace any modifications you do to the files that are not custom files. That said, I would recommend you create the GUI using GUI Guider, and then do the tweaks and extra modifications of the files on MCUXpresso or other supported toolchains like IAR or Keil MDK. The process to import a project and continue development on an IDE is described on chapter "5 Development" of the GUI Guider User Guide.

I hope this helps!

BR,
Edwin.

1,088 次查看
abs_setian
Contributor II

Thank you very much for your reply

There is 100 x 100 table as label.

For this.

1. I make huge container.

2. Put each label into container.

In this case,

  I need to set hidden 3rd row lane and need to modify position 4th row to 3th row's position

How can I should do this?

Are there any methode about finding specific child?

If you know please give me any example code.

Thanks @EdwinHz 

 

Have a good day XD

0 项奖励
回复
1,063 次查看
EdwinHz
NXP TechSupport
NXP TechSupport

Hi @abs_setian,

I'm not quite sure I understand the reasoning behind a hidden 3rd row, but I believe the situation you are presenting is about positioning each row relative to the previous row or to the container as a whole. If this is the case, you could use percentage values to align each label to a relative position of the container rather than a specific coordinate, or the lv_obj_align_to() function to align an object relative to another object. Both of these possibilities are described on the following site: Positions, sizes, and layouts — LVGL documentation

With respect to identifying child objects within the container, the simplest way to do so in GUI Guider would be to pay attention to the order that the objects are arranged on the Widgets menu. This menu arranges children by descending order. Therefore, for this arrangement of the labels inside of the container:

EdwinHz_1-1713313816875.png

  • Label_1 is child 0
  • Label_2 is child 1
  • Label_3 is child 2
  • Label_4 is child 3

If the number of labels inside a container is too large, you could also nest containers inside of the main container, which would allow referencing for each label to be similar to a grid. The first layer of child object would be the row, while the second layer of child objects would be the column. For example:

EdwinHz_2-1713314937134.pngEdwinHz_3-1713314968641.png

In this case, child 0 of the child 0 of the main container would be label "x0y0", and child 2 of child 1 of the main container would be label "x2y1".

I hope this helps!

BR,
Edwin.

979 次查看
abs_setian
Contributor II
Oh!!! I've got it!!!!
Then, I can access each object like this
: row_1->child[0].[1],[2] ... and so on.
Thank you!!!
I can keep develop.
0 项奖励
回复