Skip to main content
Version: 4.16


A SwipeContainer in TouchGFX is a specialization of the Container that consists of multiple pages, which can be accessed by swiping between them. The pages in the SwipeContainer can contain other widgets, similar to the Container.

SwipeContainer running in the simulator

Widget Group#

The SwipeContainer can be found in the Containers widget group in TouchGFX Designer.

SwipeContainer in TouchGFX Designer


The properties for the SwipeContainer are described in the following sections.

Property GroupProperty Descriptions
NameName of the widget. Name is the unique identifier used in TouchGFX Designer and code.
LocationX and Y specify the top left corner of the widget relative to its parent.

W and H specify the width and height of the widget.

Lock specifies if the widget should be locked in its current X, Y, W and H.
Locking the widget also disables interacting with the widget through the screen.

Visible specifies the visibility of the widget.
Making the widget invisible also disables interacting with the widget through the screen.
PagesSelected Page specifies the page shown on the canvas. This page will also be the starting page when the project is running.

The + button creates a new page when clicked.
Page indicatorShow page indicator specifies the visibility of the page indicator.

X and Y specify the top left corner of the page indicator relative to the top left corner of the widget.

Center horizontally specifies if the position page indicator should be centered in the x-axis of the widget.

Style specifies a predefined setup of the widget, that sets select properties to predefined values.
These styles contain images that are free to use.

Normal Image and Highlighted Image specify the images assigned to the normal and highlighted states of the PageIndicator.
Swipe settingsSwipe threshold specifies the distance that has to be swiped by the user before resulting in a page change.

End swipe elastic width specifies the distance the first and last pages can be swiped beyond the borders of the widget before stopping.
MixinsDraggable specifies if the widget is draggable at runtime.

ClickListener specifies if the widget emits a callback when clicked.

FadeAnimator specifies if the widget can animate changes to its Alpha value.

MoveAnimator specifies if the widget can animate changes to X and Y values.


The actions and triggers supported by the SwipeContainer are described in the following sections.


Standard widget actionDescription
Hide widgetHides a widget (sets visibility to false).
Show widgetMake a hidden widget visible (sets visibility to true).


The SwipeContainer does not emit any triggers.


A SwipeContainer is a Container type and does not per default appear in the draw chain. Therefore, the performance is mostly dependent on the drawing performance of the children, though the SwipeContainer also does some image drawing in the form of its PageIndicator.

For more details on drawing performance, read the General UI Component Performance section.


Generated Code#

In the generated code for the View base class we can see how the TouchGFX Designer sets up the SwipeContainer of two pages with a page indicator centered horizontally.

#include <gui_generated/screen1_screen/Screen1ViewBase.hpp>
#include "BitmapDatabase.hpp"
swipeContainerName.setXY(15, 10);
swipeContainerName.setPageIndicatorXY(210, 0);
You can use these functions and the others available in the SwipeContainer class in user code. Remember to force a redraw by calling swipeContainerName.invalidate() if you change the appearance of the widget.

TouchGFX Designer Examples#

To further explore the SwipeContainer, try creating a new application within TouchGFX Designer with the following UI template:

Swipe Container Example UI template in TouchGFX Designer

API Reference#