Can't make Tileview working

Hello,

Description

I’m a total newby with LVGL and everything is working till I’m trying to use tileview.
I created a tileview, created an array of positions array and set to the tileview.

I created 2 containers (“tiles”), applied a style to all of them, and added them to the TileView.

The problem is when I run my code, both tile content are displayed at the same time (like if both are displayed at the same place, at the same moment). And when I’m trying to drag my screen to switch tiles, it’s crashing.

I probably missed something but I duno what :frowning: and I stuck with that for several days : definitively, I need some external eyes :slight_smile:

What MCU/Processor/Board and compiler are you using?

TTGO TWatch 2020 - ESP32 based

Arduino IDE with related libraries and board (provided examples are working).

What LVGL version are you using?

v7.3.1

What do you want to achieve?

Have tileview working :slight_smile:

What have you tried so far?

If using only 1 tile, it’s working, adding the second is crashing.

Code to reproduce

All the code is on my github where LVGL’s API is embedded in C++ classes.
All objects has dedicted classes defined in a .h file and potentially a .cpp as well.

The interface itself is made in Gui.cpp

Offending code seems

	static lv_point_t valid_pos[] = { {0,0}, {0,1} };	// define tiles' position
	this->_maintv->setValidPositions( valid_pos, 2 );	// apply it

	this->_tile_datetime = new TlDateTime( this->_maintv->getTileView(), this->_maintv->getTileView() );
	this->_tile_datetime->setSize( this->_maintv );	// Resize as per tileview
	this->_tile_datetime->copyStyle( this->getStyle() );	// Copy and apply style
	this->_maintv->AddTile( this->_tile_datetime );	// Add this tile

	this->_tile_settings = new TlSettings( this->_maintv->getTileView(), this->_maintv->getTileView() );
	this->_tile_settings->setSize( this->_maintv );
	this->_tile_settings->copyStyle( this->getStyle() );	// Copy and apply style
	this->_maintv->AddTile( this->_tile_settings );	// Add this tile

Help would be VERY welcome.

Thanks

Laurent

Hi,

See the example here: https://docs.lvgl.io/latest/en/html/widgets/tileview.html#tileview-with-content

You have to position the tile manually to their desired position with lv_obj_set_pos()

Thanks : you got it.
As I didn’t placed the tile, both where at the default (0,0) position and when I scolled -> Guru.

1 Like