Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

.on_mouse_click()- function

edited November 11 in OpenSesame

Dear all,

I am struggling getting my old code-snippet to work in OS v3.2. Thus my question: Does the function .on_mouse_click() still work in the new OS version?

I have two empty text input fields. My aim is to set the cursor automatically in the first text input field. Participants should give their answer and press enter to confirm it. When the answer is given (var.response_A), the cursor should jump automatically into the second text input field so that participants can enter their answer in the second field and confirm it once again with enter.

This is the code-snippet which worked in the past but does not work any more in OS v3.2:

# Execute form and activate second text_input field 
 form._exec(focus_widget = input1)
 if var.response_A != "":
     input2.on_mouse_click((0,0))

Can you help me with this question?

Thanks a lot!

Best,
Sabry

Comments

  • edited November 11

    Hi Sabry,

    What is the error message? And what kind of object is input2?

    Eduard

  • Hi Eduard,

    well, there is no error message. I only know that the code worked in the former OS version as described above, but in the new one it does not work that way any more. Specifically, in the new OS version, one has to click with the mouse in the first text field to set the cursor there in order to enter the answer. To get the cursor in the second text field, one has to click with the mouse in the second field. Than one can press enter to confirm the answers. Object input1 and input2 are text_input widgets which I defined beforehand:

    input1 = widgets.text_input(form, return_accepts=True, var=u"response_A", text= " ")
    input2 = widgets.text_input(form, return_accepts=True, var=u"response_B", text= " ")

    Best,
    Sabry

  • Hi Sabry,

    I think some parts of the input form has changed recently, but which exactly I don't know. Specifically, whether, the on_mouse_click function still works. Can you share (a simplified version of) your experiment here, then I'll have a look whether I can make it behave like you want it.

    Best,

    Eduard

Sign In or Register to comment.