cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Screens how to Create

Richard Lowe
Senior III

I'd like to create a dynamic set of screens, where variables determine what containers are visable. Has anyone done anything like this?

For instance, will have a series of settings screens and based on those settings/variables, the screens will dynamically add or remove containers.

1 ACCEPTED SOLUTION

Accepted Solutions
Osman SOYKURT
ST Employee

Hello @Richard Lowe,

It's possible to decide which containers you want to show or hide, but all the elements of your screens need to be declared in the code. So if you mean that you want to create a new instance of a widget during runtime, it's not possible. it is possible under conditions:
- You need to have enough memory and allocate your elements in a determined range --> you need to be sure that you'll not overwrite in memory that is already used by TouchGFX

Let's say you have a custom container, and you want to show X number of this container depending on a variable value. TouchGFX can't can generate for you X of this container on runtime only if it is in a range you predefined in first place and which is safe to be overwritten. Another option instead is to have multiple instances of this custom container already declared in code, and hide/show them depending on a variable.

The function which hides or shows any drawable is the setVisible() and it's used like follows:

 

myContainer.setVisible(true);
myContainer.invalidate();

 


You can check this thread to know more about memory allocation when you need to add new widget runtime.

Osman SOYKURT
ST Software Developer | TouchGFX

View solution in original post

2 REPLIES 2
Osman SOYKURT
ST Employee

Hello @Richard Lowe,

It's possible to decide which containers you want to show or hide, but all the elements of your screens need to be declared in the code. So if you mean that you want to create a new instance of a widget during runtime, it's not possible. it is possible under conditions:
- You need to have enough memory and allocate your elements in a determined range --> you need to be sure that you'll not overwrite in memory that is already used by TouchGFX

Let's say you have a custom container, and you want to show X number of this container depending on a variable value. TouchGFX can't can generate for you X of this container on runtime only if it is in a range you predefined in first place and which is safe to be overwritten. Another option instead is to have multiple instances of this custom container already declared in code, and hide/show them depending on a variable.

The function which hides or shows any drawable is the setVisible() and it's used like follows:

 

myContainer.setVisible(true);
myContainer.invalidate();

 


You can check this thread to know more about memory allocation when you need to add new widget runtime.

Osman SOYKURT
ST Software Developer | TouchGFX