# How to call Spinbox from a component

**URL:** <http://forum.squareline.io/t/how-to-call-spinbox-from-a-component/2229>\
**Category:** How to\
**Created:** [December 14, 2023, 11:07am UTC](http://forum.squareline.io/t/how-to-call-spinbox-from-a-component/2229 "2023-12-14T11:07:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vadim\_Plotnikov](http://forum.squareline.io/letter_avatar_proxy/v4/letter/v/f475e1/32.png) [@Vadim\_Plotnikov](http://forum.squareline.io/u/Vadim_Plotnikov)\
**Post date:** [December 14, 2023, 11:07am UTC](http://forum.squareline.io/t/how-to-call-spinbox-from-a-component/2229/1 "2023-12-14T11:07:18Z")

</div>

Sorry for the simple question, I’m a beginner.

### What do you want to achieve?

Add an object to be controlled using physical buttons.

### What have you tried so far?

When objects are detected individually on the screen, there is no problem. I can add and delete from the group.  
lv\_group\_remove\_obj(ui\_Spinbox1);  
lv\_group\_add\_obj(g, ui\_Spinbox1);

When I create a component that includes a Spinbox, I don’t know how to access it.  
lv\_group\_add\_obj(g, cui\_Spinbox4);  
error: ‘cui\_Spinbox4’ was not declared in this scope  
See the variables here: ui\_comp\_compspinbox4.с

> ```
> lv_obj_t ** children = lv_mem_alloc(sizeof(lv_obj_t *) * _UI_COMP_COMPSPINBOX4_NUM);
> children[UI_COMP_COMPSPINBOX4_COMPSPINBOX4] = cui_Compspinbox4;
> children[UI_COMP_COMPSPINBOX4_LABEL11] = cui_Label11;
> children[UI_COMP_COMPSPINBOX4_SPINBOX4] = cui_Spinbox4;
> lv_obj_add_event_cb(cui_Compspinbox4, get_component_child_event_cb, LV_EVENT_GET_COMP_CHILD, children);
> lv_obj_add_event_cb(cui_Compspinbox4, del_component_child_event_cb, LV_EVENT_DELETE, children);
> ui_comp_Compspinbox4_create_hook(cui_Compspinbox4);
> return cui_Compspinbox4;
> 
> ```

or  
v\_group\_add\_obj(g, UI\_COMP\_COMPSPINBOX4\_SPINBOX4);

```auto
In file included from C:\Users\vadim\OneDrive\Desktop\Proekt\Ploski\ploski\Temp_reg_v1\ui\ui_comp.h:20,
                 from C:\Users\vadim\OneDrive\Desktop\Proekt\Ploski\ploski\Temp_reg_v1\ui\ui.h:26,
                 from C:\Users\vadim\OneDrive\Desktop\Proekt\Ploski\ploski\Temp_reg_v1\ui\ui.ino:3:
C:\Users\vadim\OneDrive\Desktop\Proekt\Ploski\ploski\Temp_reg_v1\ui\ui.ino: In function 'void knop_scren2(lv_event_t*)':
C:\Users\vadim\OneDrive\Desktop\Proekt\Ploski\ploski\Temp_reg_v1\ui\ui_comp_compspinbox4.h:18:39: error: invalid conversion from 'int' to '_lv_obj_t*' [-fpermissive]
 #define UI_COMP_COMPSPINBOX4_SPINBOX4 2

```

---

<div class="post-metadata">

**Author:** ![Vadim\_Plotnikov](http://forum.squareline.io/letter_avatar_proxy/v4/letter/v/f475e1/32.png) [@Vadim\_Plotnikov](http://forum.squareline.io/u/Vadim_Plotnikov)\
**Post date:** [December 14, 2023, 12:31pm UTC](http://forum.squareline.io/t/how-to-call-spinbox-from-a-component/2229/2 "2023-12-14T12:31:09Z")

</div>

The question is closed.  
Direct contact is not possible.  
Sample code:  
lv\_obj\_t \* child = ui\_comp\_get\_child(ui\_Compspinbox4, UI\_COMP\_COMPSPINBOX4\_SPINBOX4);  
lv\_group\_add\_obj(g, child);

There are very few examples in the documentation for beginners.
