slint icon indicating copy to clipboard operation
slint copied to clipboard

ComboBox: Popup position and width does not adjust to window resizes

Open teknalb opened this issue 1 year ago • 9 comments

4

3

Slint v1.7.0

teknalb avatar Jul 18 '24 13:07 teknalb

This is strange. I see you're using Windows, and I tried to reproduce this, but... for me the popup comes up at the right location. Is this the live-preview from the VS code extension?

tronical avatar Jul 18 '24 13:07 tronical

@tronical First picture is live-preview from the VS code extension yes, to reproduce resize the window while popup is displayed

teknalb avatar Jul 18 '24 14:07 teknalb

Got it, thank you! Yes, that's a bug.

tronical avatar Jul 18 '24 14:07 tronical

I suppose that we should pass in the x/y into show_popup as Pin<&Property<..>> so that we read them every time we render.

tronical avatar Jul 18 '24 14:07 tronical

For the CI failure, I pushed a prospective fix. Could you rebase?

tronical avatar Jul 18 '24 14:07 tronical

btw, it's same bug for popup width too not just x and y I tried to play with property binding <=> for x and y in combobox.slint in the source but didn't know how to fix it.

teknalb avatar Jul 18 '24 15:07 teknalb

Note that native popups / combobox disallow resizing while the popup is visible. So I wonder if the fix here is not to close the popup when we detect that the window is being resized. (especially if close-on-click is true)

ogoffart avatar Jul 19 '24 06:07 ogoffart

So I wonder if the fix here is not to close the popup when we detect that the window is being resized. (especially if close-on-click is true)

What if the window manager resizes the window by itself, for example due to a screen size change?

Also, for wasm builds that won't work as the user can continue to resize the canvas.

tronical avatar Jul 19 '24 08:07 tronical

What I mean is that we close the active_popup in https://github.com/slint-ui/slint/blob/master/internal/core/api.rs#L611 when receiving the event. I believe this would also happen with a native popup, they'd be closed too with this kind of screen changes.

ogoffart avatar Jul 19 '24 11:07 ogoffart