Key_Handler Function On Textfields?

i just started to look into scripting, because the Tool GUI examples for the keypresses gave me the idea to make a typewriter-tool (type a story or whatever and get accompanying music). so i took the code from the keypresses-thing and added a multiline textfield. but what i am looking for (and can’t find) is how to have the keypresses detected when typing in the textfield. currently it only shows the keys pressed when the dialog is focussed (as was the case with the original script).

i know this has to be done through the key_handler function, but i’m not sure if there is a way to bind this to the textfield instead of the dialog, as it seems to be a function that can only be on the dialog…

You can’t “intercept” the typing, but get notified of the typing “results”. this can be done by attaching a notifier to a text_fields value:

  
vb:textfield { notifier = function(new_text) print("text changed!") end }  
  

…just as it is demonstrated in one of the other Tool GUI examples, you know, the one with the multiple lines textfield. :)

ok i could have known if it wasn’t in the examples, it wasn’t possible, but i had high hopes. i’ll keep experimenting, and will use that other option. thanks for the quick reply.