Countdown timer in a float to show the time left before popup closes.

fabio m's icon

I created a floating window that closes itself after 6 seconds thanks to a delaied bang on a [close] message to the [pcontrol] that launches the [p popup].
Inside the window I have only a [deferlow] followed by a [thispatcher] object with a message of parameters settings.
I would like to show the time left before the popup closes and I put inside it a [metro 1000] followed by a [counter 1 0 5) and I would like to see the timer count and, when it reaches the zero close the window.
By now, when it opens, the timer doesn't count, showing 5.
Any idea?

Thank you.

Source Audio's icon

pcontrol close message closes patcher immediately.
How should that delay closing of the window ?
One actually does not need pcontrol at all.
message front to this patcher opens it just as well.

Max Patch
Copy patch and select New From Clipboard in Max.

Roman Thilenius's icon


i think you are supposed to do that in the mother patcher, i.e. for design reasons already.

Source Audio's icon

Starting a counter outside of mentioned patcher, and displaying contdown in
it, means again sending of countdown values into popup window.
In fact such popup window could be independent of any manual
or external control.
On loadbang open, count 6 seconds and close itself.
At least that is what I understood from the question,
Why would onr in that case place control outside of it ?

fabio m's icon

The original idea was to close the popup when a user clicked on a remote button.
Then I thought to make it close itself after a time if there were no clicks.
I did it with pcontrol because I found an example made with that.
Then I thought it would be useful showing the time left before the self closing.

To me, pcontrol or not pcontrol it's the same. I'd rather like to see and set the settings in the main patcher though: is that possible with "front"? I tried but it didn't work...

For now I ended up with this inside the popup:

And this is what I have in the main patcher.

Thanks.
f.

Source Audio's icon

message front needs to reach thispatcher object directly,
than it works.
Screenshots you posted do not work at all !

window flags and any other messages to thispatcher opbject
need to be wired or sent directly to it !
in your patch case they do not execute anything.

You either place ALL messages AND UNLOCK messages
in the popup patcher and use a toggle to lock - unlock window state
for editing, and use front and wclose messages from outside which makes more sense than pcontrol.
or ... you send ALL of that from outside, which makes no sense at all again.

Max Patch
Copy patch and select New From Clipboard in Max.

P.S:
unlock the patcher using toggle,
to open it also preventing auto-close

fabio m's icon

Yeah, I understand ... that I didn't understand how things works.
Trying to follow what you wrote, now inside the popup I have this:

and in the main I have a [p popup] with all the messages (window flag, front and wclose) on the input 2 and a bang on input 1. In this way I have the control and the settings in the main and if I need to open the popup avoiding the autoclosing I just double click on the [p popup] box after exiting the edit mode:
is there still anything wrong that I can't see?

Thank you.
f.

Source Audio's icon

In the patch I posted last you have everything inside.
Just use it.

fabio m's icon

I'll do it.
Thank you.
f.