How to detect empty responses in [dialog]

Johnny Venom's icon

simple problem but I can't seem to find the answer: With the dialog object, how can I detect if a user doesn't input text but just clicks 'OK'? Something like 'if $s1 == " " then else $s1' but that obviously doesn't work... I tried counting character output but it seems like there is no output at all if the dialog box is left blank, so there is nothing to check.

Thanks!

metamax's icon
Max Patch
Copy patch and select New From Clipboard in Max.

spectro's icon

Nice...

vichug's icon
Max Patch
Copy patch and select New From Clipboard in Max.

sooo odd.... "print" connected to sprintf shows the symbol beeing output when the button is clicked and dialog window appearing, but a right inlet of message box shows "symbol" only once the dialog box is closed

Floating Point's icon

probably to do with threading...(thread being blocked). I never use dialog object because it interrupts real-time output

Roman Thilenius's icon

it is a general issue to report if nothing is there.

not sure how to do that best with your dialog box, but to report "nothing" you could compare if somethign is in a buffer by an extra trigger.

i.e. you´d take the trigger of the message (or the nothing^^) which is coming from the dialog box.

what that is? well, if it is the mouse then we have a problem. but if it is the return key, you can catch this using [key], add some 250 ms delay (which is not 100% safe but should work in most situations, and then bang a zl reg or messagebox, where you store either the last output of the dialog - or, alternatively, when there is no output, some placeholder like 12345.

Jean-Francois Charles's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Very interesting: [dialog] outputs "symbol" then nothing.
With [coll], you get really nothing if there's no entry; here is a possible trick:

Roman Thilenius's icon

i cant test now, but wont [sel bubu] be able to report "symbol" at its second outlet?

not that it would help much, because it would report "list user entry" or "symbol "user entry"" too ...