Dynamically Adding Text To End Of A Text Box Or Text Area

There’s a technique when you want a click inside a repeating panel row to affect something on the outer form. You create an event handler on the repeating panel itself that points to a function in the outer form. Then in the repeating panel rows, you can trigger that event.

Something like this in the outer form (untested, just to give you the general idea):

  def __init__(self, **properties):
    # Set Form properties and Data Bindings.
    self.init_components(**properties)
    
    self.repeating_panel_1.set_event_handler('x-append', self.append)

  def append(self, text, **event_args):
    self.text_area_1.text += text
    self.text_area_1.focus ()

Then inside the repeating row template’s button click function:

    self.parent.raise_event('x-append', text="Text to append")

You can pull the text to append from the button text, or wherever.

3 Likes