How to center Dialog to Window when there are not parent/children to each other?

Hi,
I want to center independent Dialog to main Window, but when I use

dialog_progress.set_position(WindowPosition::CenterOnParent);

then dialog appear on center of current screen, where actually Window is.

Is there any method to set position of Dialog to center of Window like:

dialog_progress.set_at_center_of(window_main);

?

No: positioning top-level windows is the realm of the window manager, not of the toolkit.

Based on what you stated @ebassi is absolutely correct, as usual.

But just in case what you said and what you mean aren’t the same thing.

If it’s actually independent, not something you’re creating, then this

dialog_progress.set_position(WindowPosition::CenterOnParent);

doesn’t make much sense… Center on what parent?

If it’s a dialog you’re creating then setting the main_window of your application as the parent of the dialog should get you the behavior you’re after.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.