2023-09-24 11:32 PM
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.
Solved! Go to Solution.
2023-09-25 08:46 AM - edited 2024-06-14 03:21 AM
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.
2023-09-25 08:46 AM - edited 2024-06-14 03:21 AM
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.
2024-07-03 01:47 AM