Skip to content

Get main window's position coordinates #1708

Answered by mrkaragoz
mrkaragoz asked this question in Q&A
Discussion options

You must be logged in to vote

In commit 3c685d7 @TicClick added WindowInfo. This provides position and size information of the native window. This info available with eframe::Frame::info().window_info. As of writing this answer, it is not included in the latest version of egui (0.18.1) and eframe (0.18.0). In order to use this feature update the Cargo.toml as follows:

[dependencies]
egui = { git = "https://github.com/emilk/egui"}
eframe = { git = "https://github.com/emilk/egui"}

After that, it is possible to:

impl eframe::App for MyApp {
    fn update(&mut self, ctx: &egui::Context, frame: &mut eframe::Frame) {
        let window_info = frame.info.window_info.clone();
    }
}

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@TeamDman
Comment options

Answer selected by mrkaragoz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants