Dialogs, events and scriptforge in python

I have a simple test dialog with a “Buscar” button.

What I intend, using Scripforge and python, is to assign an event to the button. This event should perform some tasks in the dialog, for example write a text in the textfield.

But I don’t quite understand the instructions to associate the event to the button.

Any help?

This is the code I have written

def dialogo(Event = None):

    dlg = CreateScriptService('SFDialogs.Dialog', 'GlobalScope', 'EasyFirebird', 'Dialog1')

    txt_user = dlg.Controls('txt1')
    txt_user.Value ='sysdba'
    btn_buscar = dlg.Controls('cmdBuscar')

    btn_buscar.OnActionPerformed = control_event_handler(btn_buscar.XControlModel)

    if dlg.Execute():
        txt_user.Value = 'JC'

def control_event_handler(event = uno):
    # dlg = CreateScriptService("SFDialogs.DialogEvent", event)
    msgbox('Evento running')

dialogo()

An this is the dialog

image

You make the “connection” in the properties of the button, as in the following thread: