Issue with UTFT menu and submenu refresh

Hi.
I have an Arduino Mega 2560 and i want to use it together with UTFT and DHT humidity and temperature sensor to display the temperature and humidity of the environment. The problem is that, when using an UTFT screen with menus and submenus, while on the loop() function, i’ve coded a while(true) loop that essentially “halts” the screen from refreshing itself constantly and expects input from touching the buttons (in an if condition). while i’m in that loop i cannot update the temperature and humidity display on a constant rate.

I’ve tried to use millis(); but it won’t work inside the while.
I’ve also tried using a button that refreshes the values for 60 seconds or any other time. This works, but it’s not an optimal solution.

What do you guys suggest?

i've coded a while(true) loop that essentially "halts" the screen from refreshing itself constantly and expects input from touching the buttons (in an if condition).

Why did you that?

I've tried to use millis(); but it won't work inside the while.

Really? Post your code...

Your while true can be interrupted by an.. Interrupt call.

Set up a timer interrupt in which you set up a flag to true that it's time to go check the sensors and in your while true loop, check that flag and if it is set read the sensors, update the screen and reset the flag.