slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
17.06k stars 573 forks source link

PopupWindow is clipped by Window #2375

Open AllenDang opened 1 year ago

AllenDang commented 1 year ago

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?

hunger commented 1 year ago

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)?

AllenDang commented 1 year ago

MacOS, Slint 0.3.5, winit femovg

ogoffart commented 1 year ago

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

tp971 commented 1 year ago

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.

tronical commented 11 months ago

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.

NRohner commented 4 months ago

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.

develcooking commented 4 months ago

@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

NRohner commented 4 months ago

Thanks so much! I will check this out.