Live editabel Text

Hi,
for my project i need a text TOP that updates in real-time.
So my approach is to use the Text COMP because it does exactyl what i need.
The problem is that i am building this patch for an exhibition where people can type something in and they only see the output monitor not TD. And if somebody hits “esc” or “enter” by accident they can no longer edit the text.

So i need something to edit text in display every change and it shouldn’t close on accident.

That’s an interesting case. I can think of some potential new features to support that, but I’m not as sure on the best solution right now.

In theory you could use the ‘setKeyboardFocus’ python function to return the focus back to the Text COMP, but you need to be a little careful in using it. I tried a quick experiment by adding the call to the onFocusEnd callback of the Text COMP, but this essentially breaks the TouchDesigner UI because you’re stuck permanently in the Text COMP. You’d need a button somewhere else to break that cycle.

You could also consider building your own simple text prompt using a Keyboard In DAT or CHOP and then you can just respond to the keys you are interested in. It could be fairly simple if you always assume the cursor is at the end of the word and just add/remove characters from there.

Hope that helps.

Seems like if you use the approach above (setKeyboardFocus in onFocusEnd) you just need to have a toggle button in your network that the onFocusEnd callback checks the value of. So, if the toggle is off, it doesn’t do the setKeyboardFocus.

Thanks, you guys helpled me alot.
It works with ‘setKeyboardFocus’ and a toggle.