Two form components: size and positon of scond form affects first form

PsychoPy version: 2022.2.4

When trying to use two form components in my experiment, size and position of the second form affect the first form.

I have a form component form_1 on routine 1 and a form component from_2 on routine 2.
while form_1 is centered and set to the standard size (pos=[0, 0], size=[1, 0.7]), form_2 is placed on the right side of the screen and narrow in size (pos=[0.25, 0], size=[0.5, 0.7]).

When starting the experiment, form_1’s items are “layouted” correctly, but the form is “clipped” to the specifications of form_2.

This is what the experiment SHOULD look like:
routine 1 with form_1

routine 2 with form_2

…but …
This is what the experiment is ACTUALLY lookin like:
routine 1 with form_1

routine 2 with form_2

What can I do to get the correct behavior?
Demo of the bug attached.
untitled.psyexp (11.8 KB)
form_content.csv (168 Bytes)

Form uses an Aperture object to handle its bounds, and Apertures work on a Window-wide basis - they’re limited to individual components by just enabling the Aperture when that component is drawing itself and disabling after.

So I’m guessing what’s happening here is that the Aperture for form_2 is somehow enabled when form_1 is drawing. When I run your experiment I get the bug you describe, so I’ll be able to look into this and let you know when I’ve worked out why it’s doing this!

1 Like

Thanks :slight_smile:
In the meantime I can get it to work by calling from_1’s draw functions individually every frame.

form_1._drawExternalDecorations()
form_1._drawDecorations()
form_1._drawCtrls()

That makes sense - that will essentially draw everything in the form without the aperture. I think that will break scrolling, as controls outside of the form’s box will still be drawn, but that isn’t a problem if you have less than a page of questions.

I think I know what’s going on now - Apertures are assigned to the window as a whole, so what’s happening is that form_1 is creating its aperture and it’s assigned to the window, then form_2 is doing the same, so form_1’s aperture is overwritten. What needs to happen is each of them need to assign their apertures before each draw command, otherwise whichever one was created last will always overwrite the previous. I’ll put in a fix now for the next version.

1 Like

Makes sense.
And yes, immediately after posting I noticed that my “hot fix” (lol) did not work when dealing with scrollable forms.

So now I go for this hot fix in the beginning of the routine:

form_<i>._setAperture()