slint icon indicating copy to clipboard operation
slint copied to clipboard

PopupWindow is clipped by Window

Open AllenDang opened this issue 3 years ago • 8 comments

If I put a combobox at the very bottom of window, it's drop down popup will be totally clipped, seems the popup is drawn within the window.

I guess it is the current limitation of how popup is implemented.

Is it possible to create a popup as a model window which could be fully displayed outside main window's boundary?

AllenDang avatar Mar 14 '23 05:03 AllenDang

Sorry for you not getting a timely reply! Everybody is at Embedded World in Nuremberg right now.

What kind of environment are you running in (OS/windowing system/slint backend)?

hunger avatar Mar 16 '23 12:03 hunger

MacOS, Slint 0.3.5, winit femovg

AllenDang avatar Mar 16 '23 16:03 AllenDang

Winit doesn't implement popup window yet https://github.com/rust-windowing/winit/issues/950 so we simulate them by drawing on the window.

The Qt backend supports popup window properly currently

ogoffart avatar Mar 17 '23 08:03 ogoffart

To add to this: even if the popup window is drawn beyond the main window, if the main window is at the bottom of the screen and the combobox is at the bottom of the window, the popup menu goes outside the screen. It should go up instead, or be moved up such that it's still fully visible on screen.

tp971 avatar Jun 15 '23 22:06 tp971

I think there's enough infrastructure / exposed API in winit now that we can implement Popups at least on some platforms as separate windows.

On Windows, when the window is created with WindowBuilderExtWindows::with_owner_window, winit sets the style to popup.

On X11, create the window with with_parent_window and use X11WindowBuilderAttributes::x11_window_types to set _NET_WM_WINDOW_TYPE_POPUP_MENU.

I'm not sure what to do on macOS yet (maybe the nswindow can be manipulated directly?), and on wayland perhaps xdg_popup could be implemented on top.

tronical avatar Oct 26 '23 11:10 tronical

Would it be possible to get a combo box with scrolling? When there are many items in the box its almost impossible to access them all without having some sort of scroll functionality.

NRohner avatar May 08 '24 10:05 NRohner

@BigBeast420 Yes it's possible but so far only as an custom widget. See in https://github.com/slint-ui/slint/discussions/2657 This is written in Slint 1.0.2 so you have to change "choices" to "model"

Also the theme is way of . I would recommend to you that you use slint.dev/doc/palette I'm currently also in search of a better implementaion that would fit in to the fluent design that I'm currently using

develcooking avatar May 08 '24 11:05 develcooking

Thanks so much! I will check this out.

NRohner avatar May 08 '24 11:05 NRohner