Page 1 of 1

Display manager!

Posted: Sun Mar 01, 2026 3:59 pm
by jgu1
Hi!

I am practicing with the "Display Manager" based on the examble´s, and I am starting to understand how it works. :lol:

When I change Scene (DC_Touched), I would like to stay in that scene and “do something” — remain inside a loop, use counters, sensors, etc., and read values. That part works.
However, I would like to be able to exit the loop again when I press “Switch to Scene0" botton (DC_RoundedRect2)”. The way I have made it now, it jumps back immediately without pressing.

I hope someone can tell me which command I should use inside the loop so it exits correctly.

Thank you in advance!

Re: Display manager!

Posted: Mon Mar 02, 2026 9:27 am
by Steve-Matrix
I've not looked at your project, but the "Switch to Scene0" button should call a macro. In that macro you could change the value of a global variable (e.g. ExitTheLoop = true) and continually check that variable within your loop and react accordingly. That should allow you to leave the loop when that button is pressed.

Re: Display manager!

Posted: Mon Mar 02, 2026 3:26 pm
by BenR
It looks like you are using the DC_Touched macro to block with a loop but this is probably not ideal as you essentially stop any future touches from being actioned while you are blocking here.

I've added a new macro to the DisplayManager called GetSceneIdx which returns the current scene index. You can call this in your main and then if idx is 1 you can do your incrementing there while still allowing other touches to be detected.

Re: Display manager!

Posted: Mon Mar 02, 2026 3:34 pm
by BenR
I'm not fully sure what you're trying to do but I have modified your program slightly so that you can start a count, and stop the count again or when the count reaches 20 it will automatically stop and return to scene 0.

Hopefully highlights things a bit better.
DisplayCreatorSelf1.fcfx
(37.34 KiB) Downloaded 39 times

To move things further I would maybe have a prescale counter and use this to count up so you can reduce the main loop delay from 200ms to say 10ms and ensure touch stays nice and responsive. I can change the example to do this if that would help.

Re: Display manager!

Posted: Mon Mar 02, 2026 6:45 pm
by jgu1
Hi Steve and Ben!

Thank´s for fast reply.

My English is probably not very good, so my explanation may not be easy to understand :lol: .

What I want is to be able to choose a Scene, for example a voltmeter, and then it should stay in that scene until I select Scene 0 again, go back.

I have a “basic” example (attached) saved that I use as a starting point for a new project, made in my own way, to heavy. If you run the simulation and press voltmeter, it switches to the voltmeter and stays there, showing the variable. In other words, it remains in that loop until I press "Menu" again and can choose another menu.

That is how I would like to implement it using Display Manager. Hope it make sense ;)

** I see many advantages in using Display Manager and would like to use it.**

Thank´s in advance

Re: Display manager!

Posted: Tue Mar 03, 2026 3:30 pm
by BenR
Right I've tweaked the example a bit to have a main menu on scene 0 and a basic voltmeter on scene 1.

All of the button touches are processed by the DC_Touched callback macro.

Any additional scene processing e.g. the volt meter updates are done as part of the main loop.

The display should update every 200ms but the touch should be responded to within 10ms making it nice and responsive.

DisplayCreatorSelf2.fcfx
(41.16 KiB) Downloaded 39 times

Re: Display manager!

Posted: Wed Mar 04, 2026 5:15 am
by jgu1
Hi Ben!
Thank´s.
See what you mean with your examble. Vhen I press "Voltmeter" in main Sceneo It shift to
Scene1, but emediately it jump back to Scene0 again, in simulation and also
in "real world on the display. Just like the IF function don´t care the command?

Br Jorgen

Re: Display manager!

Posted: Wed Mar 04, 2026 10:48 am
by BenR
Aha sorry the decisions in the DC_Touched were not checking against the .Handle variable and so were always true.

They should have looked like this.
Screenshot 2026-03-04 104748.png
Screenshot 2026-03-04 104748.png (10.51 KiB) Viewed 109 times
Should be fixed now.
DisplayCreatorSelf2.fcfx
(41.43 KiB) Downloaded 25 times

Re: Display manager!

Posted: Wed Mar 04, 2026 6:22 pm
by jgu1
Hi Ben!

No sorry

Perfect :D

Many many thank´s, now it work, why have I overseen this. Now I can take next step and continue. As I mention, there are many advantages with Disp.manager.

Jorgen